Elvis
Elvis

Reputation: 289

How to hide Keyboard from inside Android's Webview?

Inside Android's webview, a from containing a textarea is processed by javascript. The problem: After submitting/processing the form, the Keyboard does not disappear, unless the user clicks outside.

I would like to make the keyboard disappear, right after form submission. How can this be achieved?

<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>

Upvotes: 1

Views: 1630

Answers (1)

Michael
Michael

Reputation: 430

$("form").reset();

Resetting the form should cause the keyboard to hide. Alternatively, you could try.

$('input').blur();

Upvotes: 1

Related Questions