js验证手机号是否正确

1、正则验证手机号是否正确:

var regTest =/^13[0-9]{1}[0-9]{8}$|15[^4]{1}[0-9]{8}$|18[0-9]{1}[0-9]{8}$|17[0-8]{1}[0-9]{8}$|14[5-9]{1}[0-9]{8}$|16[6]{1}[0-9]{8}$|19[8-9]{1}[0-9]{8}$/;
    if(!regTest.test(mobile)) {
        alert('电话格式不对,请检查');
        return;
    }

 

转载于:https://www.cnblogs.com/guangang/articles/9264394.html

你可能感兴趣的:(js验证手机号是否正确)