0
當電子郵件地址無效時,它在IF中正常工作。然後,當我去並輸入一個有效的電子郵件時,ELSE應該觸發並清除錯誤的div。修復後的Jquery郵件驗證火災安全
<SCRIPT>
$(document).ready(function(){
$("#email").blur(function(){
var emailReg = /^([\w-\.][email protected]([\w-]+\.)+[\w-]{2,4})?$/;
if (!emailReg.test(email.value)) {
$("#theErrorDivID").html('Email Address Is Not Valid!');
$('#email').css("background-color","red");
$('#email').focus();
}
else {
$("#theErrorDivID").html = "";
}
})
});
</SCRIPT>