HTML5的novalidate和formnovalidate属性有什么区别? [英] What's the difference between novalidate and formnovalidate attributes of HTML5?
问题描述
在w3c学校,我们有这些定义:
$ b
novalidate :
当出现时,它指定表单数据(输入)在提交时不应该被
验证。
$ b $ p formnovalidate :
目前,它指定该元素在提交时不应该被
验证。
它是否使用在表单中使用 novalidate 的提交按钮中的formnovalidate ?
?(我真的没有区别)
novalidate
应用于表单,并防止验证; formnovalidate
应用于提交按钮,并覆盖 novalidate
选项(如果存在);这意味着'提交此表单而不验证,无论一般表单设置如何'。
规范中给出的示例是用户保存数据而不是发布数据;数据可能不完整且无效,但不需要验证即可保存。
From w3c schools we have these definitions:
novalidate:
When present, it specifies that the form-data (input) should not be validated when submitted.
formnovalidate:
When present, it specifies that the element should not be validated when submitted.
Does it make any difference using formnovalidate in the submit button insted of using novalidate in the form?
(I really don't get the difference)
novalidate
is applied to the form, and prevents it from being validated; formnovalidate
is applied to a submit button, and overrides the novalidate
option, if present; it means 'submit this form without validating, regardless of the general form setting'.
The example given in the spec is when a user is saving data rather than publishing it; the data might be incomplete and invalid, but doesn't require validation to be saved.
这篇关于HTML5的novalidate和formnovalidate属性有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!