我希望 Android 软键盘有一个“完成”按钮在正确的时刻按钮,无需 JAVA
我知道有人提出并回答了有关 Android 软键盘及其默认显示哪些按钮、在什么情况下以及如何修改它们的问题。
然而,所有的答案都涉及到改变Java代码。由于我正在使用 Phonegap 和 jQueryMobile 编写跨平台应用程序,因此我不想学习 Java。
我的问题是这样的: 我有一个表单(按此顺序,缩写为 html):
<form action='javascript:processSubmit()'>
<select id='expenseType'/>
<input type='text' id='expenseAmount'/>
<select id='expenseDate'/>
<button type='submit'/>
</form>
当前发生的情况是,一旦我按下文本输入字段,就会出现软键盘。到目前为止,一切都很好。软键盘右下角的按钮显示“下一步”。但按下它不会将焦点转移到下一个表单字段。当用户单击第二个选择并选择一个值时,键盘按钮不会更改为“完成”。
有没有办法给字段一些特殊的 html 属性来使魔法发生?
或者用 Javascript 的方式来改变软键盘?
I'm aware that questions have been asked and answered about the Android soft keyboard and which buttons it shows by default, and in what circumstances, and how to modify them.
However, all the answers involve changing the Java code. Since I am writing a cross-platform app using Phonegap and jQueryMobile, I'd like to stay away from learning Java.
My problem is this:
I have a form with (in this order, in abbreviated html):
<form action='javascript:processSubmit()'>
<select id='expenseType'/>
<input type='text' id='expenseAmount'/>
<select id='expenseDate'/>
<button type='submit'/>
</form>
What currently happens is that the soft keyboard will appear once I press the text input field. So far so good. The button in the bottom right corner of the soft keyboard says 'Next'. But pressing it does not shift the focus to the next form field. And when the user has clicked on the second select and picked a value, the keyboard button does not change to 'Done'.
Is there not a way to give the fields some special html attribute to make the magic happen?
Or a Javascript way to change the softkeyboard?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
AFAIK,JavaScript 或 HTML 无法影响 Android 软键盘的行为。
AFAIK, there is no way from JavaScript or HTML to affect the behavior of the Android soft keyboard.
我知道这是一个非常古老的问题,但是有了这个插件 https://github.com/driftyco/ ionic-plugin-keyboard 您可以使用 Keyboard.hideKeyboardAccessoryBar 方法更改此行为
I know that is a very old question, but with this plugin https://github.com/driftyco/ionic-plugin-keyboard you can change this behaviour with the Keyboard.hideKeyboardAccessoryBar method