在 Android 的 webview 中,包含文本区域的 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();
关于javascript - 如何从 Android 的 Webview 中隐藏键盘?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22499890/