Email Validation: Cross browser Email Validation in JS. JavaScript for Email Address Validation with explanation of the code.The script on this page has been updated to deal with cross-browser issues. Learn how to validate a users email address using Javascript.
Using Regular Expressions is probably the best way. Here's is an function Which will return true if Email is a Valid email and false if email is not valid .
<script>
function
validateEmail(email) {
var regstring
= /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\
".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA
-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return regstring.test(email);
}
</script>
But keep in mind that one should not rely only upon JavaScript validation. JavaScript can easily be disabled. This should be validated on the server side as well.