I need to validate hidden fields, so I have this below (validate hidden fields)
$.validator.setDefaults({ ignore: [] });
I would like to ignore a certain class as well, but I'm not sure of the syntax to get both.
$.validator.setDefaults({ ignore: "[], .ignoreThisClass" });
This obviously does not work but how can I specify to both validate hidden and ignore my class?
It's an array of jquery selectors. If the element matches the selector, it is ignored.
$("#form_id"). valid(); Checks whether the selected form is valid or whether all selected elements are valid. validate() needs to be called on the form before checking it using this method.
Definition of jQuery validate errorplacement. The jQuery validate errorplacement() function is used to customize the placement of an error message. This function is a built-in function in jQuery. These function changes the default behavior of the validation plugin to insert the error label after the input fields.
An unobtrusive validation in jQuery is a set of ASP.Net MVC HTML helper extensions.By using jQuery Validation data attributes along with HTML 5 data attributes, you can perform validation to the client-side.
Add your class to the array instead.
$.validator.setDefaults({ ignore: [".ignoreThisClass"] });
It's an array of jquery selectors. If the element matches the selector, it is ignored. By default it is [":hidden"]
which is why making it []
makes it allow hidden elements.
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