我需要一个同时具有数字和 - 符号的键盘,因为缺少 input="tel"我想我会使用 input="number"代替,但是每当我完成输入时,它都会将数字解析为另一种格式,例如:“19880522-3243”变为“19 880 522”。
有谁知道我如何获得带“-”的数字键盘或禁用 input="number"时发生的解析?
最佳答案
如 jQuery Mobile 中指定的那样 documentation .引用网站:
In jQuery Mobile, you can use existing and new HTML5 input types such as password, email, tel, number, and more. Some type values are rendered differently across browsers. For example, Chrome renders the range input as a slider. jQuery Mobile standardizes the appearance of range and search by dynamically changing their type to text. You can configure which input types are degraded to text with the page plugin's options.
One major advantage of using these more specific input types if that on mobile devices, specialized keyboards that speed data entry are offered in place of the standard text keyboard. Try the following inputs on a mobile device to see which display custom keyboards on various platforms.
虽然文档中没有明确说明,但检查示例的来源表明可以使用 type=""
定义输入类型。属性。试一试:
<input type="tel" name="tel" id="tel" value="" />
关于jquery - 在 iPhone 中禁用数字键盘解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12007407/