Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个加载 HTML 表单的 UIWebView。
当我选择一个文本字段时,键盘会出现。
当我键入并点击“Go”时,表单被提交并加载下一页,但键盘并没有消失,它停留在屏幕上。
摆脱键盘的唯一方法是按下键盘上的“完成”按钮或按下表单中的 HTML 提交按钮。
点击Go按钮后是否可以使键盘消失?
谢谢!
您需要在表单提交时让活动输入退出焦点。最简单的方法是调用.blur()表单onsubmit事件处理程序中的所有输入
.blur()
onsubmit
<form onsubmit="document.getElementById('myInput').blur();"> <input type="text" id="myInput"/> </form>