Skip to content

Instantly share code, notes, and snippets.

@MathRivest
Created July 25, 2014 17:29
Show Gist options
  • Select an option

  • Save MathRivest/a17c4ba6f77406d2622e to your computer and use it in GitHub Desktop.

Select an option

Save MathRivest/a17c4ba6f77406d2622e to your computer and use it in GitHub Desktop.
jQuery Validate phone number
jQuery.validator.addMethod("phone", function(value, element) {
return this.optional(element) || /^[1-9]\d{2}([-\ /\.])?[1-9]\d{2}([-\ /\.])?\d{4}$/.test(value);
}, "wrong phone");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment