1. 程式人生 > >jquery驗證手機號碼

jquery驗證手機號碼

格式 func ems nbsp false 手機 code bmi true

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; }

jquery驗證手機號碼