Skip to content

Instantly share code, notes, and snippets.

@uhtred
Created March 14, 2016 21:55
Show Gist options
  • Save uhtred/8adfddd1043d22e003a2 to your computer and use it in GitHub Desktop.
Save uhtred/8adfddd1043d22e003a2 to your computer and use it in GitHub Desktop.
JS: Jquery Validate Custom
$.validator.addMethod("cMinlength", function(value, element, param) {
var isValid = $.validator.methods.minlength.call(this, value, element, param.length);
$.validator.messages['cMinlength'] = param.message;
return isValid;
});
$.validator
.addClassRules({
'validate-name': {
cMinlength: {
length: 6,
message: $.validator.messages.clientName
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment