How to validate email id in javascript

Find the below code by which you can validate the email field using java-script on client side,

var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/;
if(!reg.test(document.getElementById(“email”).value)){
alert(“Please fill email address in correct format”);
document.getElementById(’email’).focus();
return false;
}


To seek challenging roles and to achieve excellence in the field of Open Source Web Technology with a profound spirit of commitment and dedication.

Share This Post

Related Articles

© 2017 Sumit Bansal. All rights reserved. Site Admin · Entries RSS · Comments RSS
Powered by WordPress · Designed by Theme Junkie