Blog Image

validate email id using jquery or javascript

function validateEmail(email) {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,6})?$/;
return emailReg.test(email);
}

Usage:-

if(validateEmail(emailString)){
   alert('Your email is valid');
}
else{
  alert('Your email is not valid! There should be atleast @ and one dot(.) present in it');
}



Author: admin

Vinod Ram has been in Software Industry since 2006 and has experience of over 16 years in Software Development & Project Management domain specialised majorly in LAMP stack & Open Source Technology, building enterprise level Web based Application, Large Database driven and huge traffic Websites and Project Management. He loves to write information articles and blog to share his knowledge and experience with the outside world and help people to find solution for their problems.