We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTML5 为表单验证提供了极大的方便,在验证表单方式上非常灵活,提供了专门用于表单验证的属性、方法和事件。
required:用以设置必填项
required
<!-- 此时当文本框为空时,其所在表单无法提交 --> <input name="name" type="text" required>
min、max 和 step:用于为包含数字或日期的 input 类型规定限定(约束),其中:
min
max
step
<input name="volume" type="range" min="0" max="100" step="2">
pattern:用于为 input 元素定义一个验证模式,其值是正则表达式,这是一个非常灵活的验证特性
pattern
<!-- 如输入内容不符合 pattern 给定的格式,则不能提交 --> <input name="code" type="text" pattern="[0-9]{6}" placeholder="6位邮政编码">
novalidate:用于指定表单或表单内的元素在提交时不验证。
novalidate
<!-- 此时表单中所有元素在提交时都不再验证 --> <form novalidate> <!-- 表单元素... --> </form>
The text was updated successfully, but these errors were encountered:
No branches or pull requests
HTML5 为表单验证提供了极大的方便,在验证表单方式上非常灵活,提供了专门用于表单验证的属性、方法和事件。
required
:用以设置必填项min
、max
和step
:用于为包含数字或日期的 input 类型规定限定(约束),其中:max
属性规定输入域所允许的最大值min
属性规定输入域所允许的最小值step
属性为输入域规定合法的数字间隔(如果 step="3",则合法的数是 -3,0,3,6 等)pattern
:用于为 input 元素定义一个验证模式,其值是正则表达式,这是一个非常灵活的验证特性novalidate
:用于指定表单或表单内的元素在提交时不验证。The text was updated successfully, but these errors were encountered: