📌  相关文章
📜  使用 javascript 代码示例在前端进行电子邮件验证的代码

📅  最后修改于: 2022-03-11 15:03:03.005000             🧑  作者: Mango

代码示例2
function checkEmail() {

    var email = document.getElementById('txtEmail');
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    if (!filter.test(email.value)) {
    alert('Please provide a valid email address');
    email.focus;
    return false;
 }
}

- Call the function on Email textbox