手机正则写法
$.validator.addMethod("cnphone", function(value, element, params) {
var length = value.length;
var mobile = /^(((1(3|4|5|7|8)[0-9]{1}))+\d{8})$/
if (length == 11 && mobile.test(value) || !params) {
return true;
} else {
return false;
}
}, "请输入正确的手机号")
1[34578][0-9]{9}? 也行
function isRight(text){
var phoneE = document.getElementById("phoneE");
var flag = false;
var re =new RegExp("/^1[3|4|5|8][0-9]\d{8}$/");
flag = re.test(text);
if(flag){
phoneE.innerHTML = "";
}else{
phoneE.innerHTML = "不是正确完整的11位手机号";
}
}