How do you create a simple, custom rule using the jQuery Validate plugin (using addMethod
) that doesn't use a regex?
For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?
javascriptjqueryjquery-validate
How do you create a simple, custom rule using the jQuery Validate plugin (using addMethod
) that doesn't use a regex?
For example, what function would create a rule that validates only if at least one of a group of checkboxes is checked?
Best Answer
You can create a simple rule by doing something like this:
And then applying this like so:
Just change the contents of the 'addMethod' to validate your checkboxes.