Created
July 25, 2014 17:29
-
-
Save MathRivest/a17c4ba6f77406d2622e to your computer and use it in GitHub Desktop.
jQuery Validate phone number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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