Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save huseyinyildirim/e0b22718bc11443cf5f63bdaba96df98 to your computer and use it in GitHub Desktop.
Save huseyinyildirim/e0b22718bc11443cf5f63bdaba96df98 to your computer and use it in GitHub Desktop.
jQuery.validator.addMethod("phoneTR", function (phone_number, element) {
//5321234567
phone_number = phone_number.replace(/\s+/g, "");
return this.optional(element) || phone_number.length > 9 && phone_number.match(/^5[0-9][0-9][1-9]([0-9]){2}([0-9]){4}$/);
}, "Lütfen telefon numarasını kontrol ediniz.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment