1jQuery.validator.addMethod("exactlength", function(value, element, param) {
2 return this.optional(element) || value.length == param;
3}, $.validator.format("Please enter exactly {0} characters."));
1$("#formtovalidate").validate({
2 rules: {
3 somefield: {
4 exactlength: 10
5 }
6 });