簡體   English   中英

如何從Android的Webview內部隱藏鍵盤?

[英]How to hide Keyboard from inside Android's Webview?

在Android的webview內,包含textarea的from由javascript處理。 問題:提交/處理表單后,除非用戶在外部單擊,否則鍵盤不會消失。

我想在提交表單后立即使鍵盤消失。 如何做到這一點?

<form>
    <textarea>Hi there...</textarea>
</form>

<script>
   $("form").submit(function(){
      processForm();

      // I tried .blur() and .focusout(), which make the textarea loose focus, 
      // but the keyboard still does not hide...
      // $("textarea").blur();
      // $("textare").focusout();

      return false;       
   })
</script>
$("form").reset();

重置窗體應導致鍵盤隱藏。 或者,您可以嘗試。

$('input').blur();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM