HTML5的novalidate和formnovalidate属性有什么区别? [英] What's the difference between novalidate and formnovalidate attributes of HTML5?

查看:887
本文介绍了HTML5的novalidate和formnovalidate属性有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆