Created
October 16, 2014 18:10
-
-
Save uhtred/833f3b957d61e94fbff6 to your computer and use it in GitHub Desktop.
JS:Extend jQuery Validate Native Methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.validator.addMethod("cMaxlength", function(value, element, param) { | |
return $.validator.methods.maxlength.call(this, value, element, param[1]); | |
}, '{0}'); | |
/* | |
USE | |
$.validator.addClassRules({ | |
'credit-card': { | |
cMaxlength: [ 'Invalid number.', 19 ] | |
} | |
}); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment