jquery validation max length rule code example
Example 1: lenght validation using jquey valisaton
jQuery.validator.addMethod("exactlength", function(value, element, param) {
return this.optional(element) || value.length == param;
}, $.validator.format("Please enter exactly {0} characters."));
Example 2: lenght validation using jquey valisaton
$("#formtovalidate").validate({
rules: {
somefield: {
exactlength: 10
}
});