gpt4 book ai didi

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

转载 作者:太空狗 更新时间:2023-10-29 15:07:14 26 4
gpt4 key购买 nike

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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com