html - novalidate HTML 属性有什么作用?

标签 html forms attributes

novalidate 属性在 HTML 的表单标签中有什么作用?

最佳答案

向表单元素添加 novalidate 属性可防止对表单元素进行原生验证(如果应用),让您的 JavaScript 能够畅通无阻地管理所有验证

Based on the HTML5 course on Linda:

The novalidate attribute prevents forms from running their validation logic when the form is submitted. In other words, it always lets the form submission process go through regardless of what the results of validation logic would normally.Now why would you want to do some like that? Well, one main use of this is to allow a user to save a form's state so they can continue later without having to first validate all the entries.

So if your web site, for example, is having a user fill out a form and the user wants to be able to save their progress, you can disable your form's validation laws, and let them submit the form and continue on later without having to force them to validate everything first

There are two attributes actually that enforces behavior. If you want to use novalidate directly on the form tag, you can use the novalidate atrribute right on the form itself.You can also do this on per control basis.

关于html - novalidate HTML 属性有什么作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45337792/

相关文章:

html - 使用图像作为边框 CSS3

javascript - HTML - 用十进制值排序选择

html - 修复了顶部导航栏不起作用的问题

algorithm - 分析/分类算法以将人们添加到兴趣组中

c++ - 为什么 GCC 不强制 __attribute__((pure)) 函数中的参数为常量?

html - 在 html/xhtml 中解析 RDFa?

forms - bool 值和选择 symfony 类型

php - 从 SQL 查询中选择正确的 PHP 单选按钮

javascript - 提交后重置 HTML 表单

attributes - Magento2:添加产品属性作为媒体图像