这里我有一个HTML5
输入.....
<input type="number" pattern="\d{10}" data-pattern-msg="enter a value according to the pattern" />
但这并没有验证这个模式...... 这是什么原因??
最佳答案
这里是 W3C HTML 检查器(验证器)的维护者。检查器为您的示例发出错误的原因是 HTML 规范不允许 pattern
为 <input type=number>
指定的属性要素;请参阅 the section on the HTML spec on <input type=number>
的 Bookkeeping details 部分中的 The following content attributes must not be specified and do not apply to the element 列表.
而且我不确定大多数浏览器是否支持使用 placeholder
与 <input type=number>
.
关于html - 我可以添加输入类型为数字的模式属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32293650/