How I can call a validate method created with jQuery.validator?
Example:
jQuery.validator.addMethod("functionA", function(value, element) {
if($.trim(value)==""){
return false;
}
return true;
}, "MSG A");
jQuery.validator.addMethod("functionB", function(value, element) {
return jQuery.functionA(); //<--- How do I do it?
}, "MSG B");
Methods added with addMethod
are inside the $.validator.methods
object. You can call functionA
like this:
jQuery.validator.addMethod("functionB", function(value, element) {
return jQuery.validator.methods.functionA.call(this, value, element);
}, "MSG B");
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