/*** check Mobile***********************/
jQuery.validator.addMethod("isMobile", function(value, element,param) {
//var pattern=/(^0{0,1}[13|15|18|14|17]{2}[0-9]{9}$)/;
var pattern= /(^1[3,4,5,7,8]{1}[0-9]{9}$)/;
//var pattern= /(^\d{15}$)|(^\d{17}([0-9]|X|x)$)/; (验证15位或18位身份证号码,最后一位可以为x)
//var pattern = /(?:\(?[0\+]?\d{1,3}\)?)[\s-]?(?:0|\d{1,4})[\s-]?(?:(?:13\d{9})|(?:\d{7,8}))/;
if(pattern.test(value)){
return true;
}else{
return false;
}
}, "请输入正确的手机号");
$('#editForm').validate({
rules : {
isMobile: {
isMobile:true,
}
},
messages : {
isMobile: {
isMobile: '请输入正确的手机号',
} }
});