更新时间:2022-06-21 23:29:33
try this
$("#phone").blur(function () {
var regexp = /^[\s()+-]*([0-9][\s()+-]*){6,20}$/
var no = $("#phone").val();
if (!regexp.test(no)&& no.length<0) {
alert("Wrong phone no");
}
});
<input type="text" id="phone"/>