电话:用于文本输入的数字键盘 [英] Phone: numeric keyboard for text input
问题描述
有没有办法强制数字键盘出现在手机上< input type =text>
?我刚刚意识到 < input type =number HTML5中的>
用于浮点数,因此不适用于信用卡号,邮政编码等。
Is there a way to force the number keyboard to come up on the phone for an <input type="text">
? I just realized that <input type="number">
in HTML5 is for "floating-point numbers", so it isn’t suitable for credit card numbers, ZIP codes, etc.
我想模拟< input type =number>
的数字键盘功能,对于采用除浮动之外的数值的输入 - 点数。也许还有另一个适当的输入
类型吗?
I want to emulate the numeric-keyboard functionality of <input type="number">
, for inputs that take numeric values other than floating-point numbers. Is there, perhaps, another appropriate input
type that does that?
推荐答案
您可以< input type =textpattern =\d *>
。这将导致出现数字键盘。
You can do <input type="text" pattern="\d*">
. This will cause the numeric keyboard to appear.
详情请见此处:适用于iOS的文本,Web和编辑编程指南
这篇关于电话:用于文本输入的数字键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!