jquery验证手机号码

function checkSubmitMobil() {
    if ($("#tel").val() == "") {
    alert("手机号码不能为空!");
               //$("#moileMsg").html("<font color='red'>手机号码不能为空!</font>");
    $("#tel").focus();
    return false;
  }
//        var pattern = /^1[34578]\d{9}$/;
    if (!$("#tel").val().match(/^1[34578]\d{9}$/)) {
        alert("手机号码格式不正确!");
         //$("#moileMsg").html("<font color='red'>手机号码格式不正确!请重新输入!</font>");
        $("#tel").focus();
        return false;
        }
    return true;
    }

 

posted @ 2017-06-09 20:39  永醉雨辰  阅读(1894)  评论(0编辑  收藏  举报