Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

jquery validation phone number

function validatePhone(txtPhone) {
    var a = document.getElementById(txtPhone).value;
    var filter = /^((+[1-9]{1,4}[ -]*)|(([0-9]{2,3})[ -]*)|([0-9]{2,4})[ -]*)*?[0-9]{3,4}?[ -]*[0-9]{3,4}?$/;
    if (filter.test(a)) {
        return true;
    }
    else {
        return false;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #jquery #validation #phone #number
ADD COMMENT
Topic
Name
4+7 =