根据苹果的文档 http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariHTMLRef/Articles/InputTypes.html当我设置一个类型为的输入元素时number
我应该买一个数字键盘。
<input type="number"/>
number
:
用于指定数字的文本字段。在 iOS 3.1 及更高版本中调出数字键盘。
看起来几乎不可能搞砸。然而,当我在 iPhone 或模拟器(均为 iOS6)上查看这个简单的小提琴时,数字键盘不会出现,而是显示标准字母键盘。
http://jsfiddle.net/Cy4aC/3/ http://jsfiddle.net/Cy4aC/3/
我到底把什么事情搞砸了?
您需要指定模式:
<input type="number" pattern="\d*"/>
As a number
can be negative or with floating point, so the - and . and , should be available in the keyboard, unless you specify a digits only pattern.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)