我怎样才能让用户输入“。”在带有 <input> 的 iOS 数字键盘中?
How can I allow users to enter "." in an iOS numeric keyboard with <input>?
我读过这个post:
https://css-tricks.com/finger-friendly-numerical-inputs-with-inputmode/
说我可以用下面的代码让用户用纯数字虚拟键盘输入数字,比传统的虚拟键盘方便多了:
<label for="creditcard">credit card number:</label> <input pattern="[0-9]*" type="text" name="creditcard">
但是这里无法输入点。例如,如果我想输入 5.6
或 6.0
,我就卡在那里了。
有什么办法可以做到这一点吗?
替换
<input type="number" inputmode='numeric"/>
来自
<input type="number" inputmode='decimal'/>
我希望你在 COVID-19 中过得很好并且安全。
<input type="tel" inputmode='decimal'/>
我一直在使用 input type = tel 它接受模式参数并在移动设备上提取数字键盘输入。
移动设备上 type=”tel” 的键盘有一些 phone-specific 字符,例如 #,但在更好地支持输入模式之前,这不是一个糟糕的解决方案,即使它在语义上感觉是错误的。它似乎不会以负面方式影响屏幕阅读器。
谢谢
我读过这个post:
https://css-tricks.com/finger-friendly-numerical-inputs-with-inputmode/
说我可以用下面的代码让用户用纯数字虚拟键盘输入数字,比传统的虚拟键盘方便多了:
<label for="creditcard">credit card number:</label> <input pattern="[0-9]*" type="text" name="creditcard">
但是这里无法输入点。例如,如果我想输入 5.6
或 6.0
,我就卡在那里了。
有什么办法可以做到这一点吗?
替换
<input type="number" inputmode='numeric"/>
来自
<input type="number" inputmode='decimal'/>
我希望你在 COVID-19 中过得很好并且安全。
<input type="tel" inputmode='decimal'/>
我一直在使用 input type = tel 它接受模式参数并在移动设备上提取数字键盘输入。 移动设备上 type=”tel” 的键盘有一些 phone-specific 字符,例如 #,但在更好地支持输入模式之前,这不是一个糟糕的解决方案,即使它在语义上感觉是错误的。它似乎不会以负面方式影响屏幕阅读器。 谢谢