How to make custom validators for jQuery validate
Occassionally you need to validate a specific rule in forms. It would be stupid to roll the entire validation library from scratch so instead it’s better to make a custom validator that works with jQuery validate. So, for example, below is a validator that checks that the user didn’t just enter all same characters.
In coffeescript:
The parameters are:
value
is the value in the inputelem
is the input itselfparam
is the parameter passed to the validator method when you initialize the validation
Then to use it you can use it as so: