I'm wondering if I could do something to disable HTML5 validation for every form in my application.
Is there any way to do this or I just should add novalidate
attribute for each form tag?
novalidate attribute is used in form tag to disable HTML5 based Form validation. After using novalidate in form tag, required and type based validation will not work.
Description. You can disable the form validation either by applying the novalidate attribute to the form element, or the formnovalidate attribute to the types of the button and input elements that can submit forms.
novalidate if a form-level attribute used to turn off validation for a form, despite the attributes of the inputs it contains (i.e. will override inputs with the required attribute, or that would otherwise fail validation).
The novalidate attribute in HTML is used to signify that the form won't get validated on submit. It is a Boolean attribute and useful if you want the user to save the progress of form filing. If the form validation is disabled, the user can easily save the form and continue & submit the form later.
It seems the only way is to add novalidate
attribute to each form using javascript/jquery, like this:
$(document).ready(function() {
$("form").attr('novalidate', 'novalidate');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With