function validEmail(e) {
var filter = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
if(filter.test(e)){alert("valid email")}
else{alert("invalid email")}
}
if(filter.test(e)){alert("valid email")}
else{alert("invalid email")}
}
this code will throw false for any invalid email address. This code checks validity with respect to what is email pattern and what are permissible characters
No comments:
Post a Comment