[英] Is there a minlength validation attribute in HTML5?
<input>
字段的minlength
属性似乎不起作用.
HTML5中是否有其他属性可以帮助我设置字段值的最小长度?
<input>
字段的minlength
属性似乎不起作用.
HTML5中是否有其他属性可以帮助我设置字段值的最小长度?
你可以用pattern
attribute美元.required
attribute也是必需的,否则将从constraint validation中排除具有空值的输入字段.
<input pattern=".{3,}" required title="3 characters minimum">
<input pattern=".{5,10}" required title="5 to 10 characters">
如果要创建将图案用于"空或最小长度"的选项,可以执行以下操作:
<input pattern=".{0}|.{5,10}" required title="Either 0 OR (5 to 10 chars)">
<input pattern=".{0}|.{8,}" required title="Either 0 OR (8 chars minimum)">
如何将 如何在 HTML 中指定 Unicode 字符的表情符号版本? 溢出:隐藏对 :after 和 :before 伪元素不起作用