为 HTML 管理 iOS 键盘 <input>
形式(用于 UIWebView
)是众所周知的,即 <input type="tel"></input>
电话号码。
但我想知道键盘上的蓝色“开始”按钮。 有时键盘上有一个蓝色的“开始”按钮,有时键盘上有一个灰色的返回按钮。 是否有机会以编程方式控制此行为?
最佳答案
2020/2021 年更新
作为Cameron Cobb指出,
Safari Mobile 支持新的 HTML 属性 enterkeyhint
自版本 13.7 ~ 2020 年 9 月 (https://caniuse.com/mdn-html_global_attributes_enterkeyhint)。
以下值是可能的 ( https://mixable.blog/ux-improvements-enterkeyhint-to-define-action-label-for-the-keyboard-of-mobile-devices/ ):
<input enterkeyhint="enter">
<input enterkeyhint="done">
<input enterkeyhint="go">
<input enterkeyhint="next">
<input enterkeyhint="previous">
<input enterkeyhint="search">
<input enterkeyhint="send">
原始答案
啊哈...
只有在 <input>
出现时才会显示“开始”按钮。标签在 <form>
内标签(表单标签有一个 action
属性)。
因此,如果您随后使用 JavaScript 访问表单元素,则可以省略 <form>
标签。
“开始”按钮:
<form action="..." method="...">
<input type="text"></input>
</form>
“返回”按钮:
<input type="text"></input>
关于ios - 用于 HTML 输入表单的 iOS 键盘中的转到与返回按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22986347/