HTML
Jquerty
$.validator.addMethod('zipcode', function(postalcode,element){ return this.optional(element) || postalcode.match(/^\d{5}$|^\d{5}\-\d{4}$/) || postalcode.match(/^\d{9}$|^\d{9}\-\d{8}$/); },"Please enter 5 or 9 digits valid zip code");
jQuery(document).ready(function () { $("#mainForm").validate({ rules: { txtBillingInfoPostalCode:{zipcode:true} } }); });
No comments:
Post a Comment