I\'m writing a custom method for a jQuery plugin:
jQuery.validator.addMethod(\"alphanumeric\", function(value, element) {
return this.optional(elemen
// use below ... It is better parvez abobjects.com
jQuery.validator.addMethod("postalcode", function(postalcode, element) {
if( this.optional(element) || /^[a-zA-Z\u00C0-\u00ff]+$/.test(postalcode)){
return false;
}else{
return this.optional(element) || /^[a-zA-Z0-9]+/.test(postalcode);
}
}, "
Invalid zip code");
rules:{
ccZip:{
postalcode : true
},
phone:{required: true},
This will validate zip code having no letters but alphanumeric