前端邮箱校验全过程

完整的邮箱校验
html

<label class="register"><i class="dot">*i>更改后邮箱账号:label>
<input type="text" name="webRegPersonInfo.email" id="newEmail" placeholder="请输入新的邮箱">
<label id="emailmsg">label><br>

js

$("#newEmail").focusout(function(){
	var email=document.getElementById("newEmail").value;
	$("#emailmsg").empty();
            if (email != "") {
            var reg = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
                isok= reg.test(email);
                if (!isok) {
                    $("#emailmsg").append("");
                    $("#emailmsg").append("邮箱格式错误");
                    
                 //   document.getElementById("emailname").focus();
                    return false;
                }
            };
	
});```

你可能感兴趣的:(hibernate,java,javascript)