You can add a custom validator
jQuery.validator.addMethod("phoneStartingWith6", function(phone_number, element) {
phone_number = phone_number.replace(/\s+/g, "");
return this.optional(element) || phone_number.match(/^6\d{8,}$/);
}, "Phone number should start with 6");
and use it as follows:
rules: {
phone: {
required: true,
minlength: 9,
phoneEnding6: true
},..
You need to edit the regex inside phone_number.matchto suit your requirements.
source
share