Created
February 16, 2017 09:47
-
-
Save gayanhewa/d6544c325f901b559f191f652aaa0dcd to your computer and use it in GitHub Desktop.
jquery validator australian phone number
This file contains 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("au_phone", function(value, element) { | |
return this.optional(element) || /^(?:\+?(61))? ?(?:\((?=.*\)))?(0?[2-57-8])\)? ?(\d\d(?:[- ](?=\d{3})|(?!\d\d[- ]?\d[- ]))\d\d[- ]?\d[- ]?\d{3})$/.test(value); | |
}, "Invalid phone number"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment