Android WebView 中输入字段的默认操作
我在 Web 视图中显示一个标准
如何停止发布表单并将焦点放在下一个输入字段上?
编辑: 通过在页面中添加一段javascript来解决问题;
<body onkeypress='return event.keyCode!=13; '>
I'm displaying a standard <form>
with a few <input>
fields in a web view.
When editing the first input field and pressing the enter key on the soft keyboard, the form is posted insted of focusing the next input field in the form.
How can I stop the form from being posted and instead put focus on the next input field?
Edit:
Problem solved by adding a piece of javascript to the page;
<body onkeypress='return event.keyCode!=13; '>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您尝试在 Java 文件中连接“OnClick”事件 - 我认为这是不可能的。 “WebView”控件仅显示CSS/HTML/JS(即网页)。
不过,您应该能够使用 JavaScript 片段来完成此操作。沿着这些思路:
If you're trying to wire up an "OnClick" event in your Java file - I don't think it's possible. The "WebView" control just displays CSS/HTML/JS (i.e. web pages).
You should be able to use a javascript snippet to accomplish this though. Something along these lines: