Validate Email Using Java Script

This code shows how to Validate Email Using JavaScript


function validate()
{
//Validate Email.....

validRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/i;
strEmail = document.getElementById("txtEmail").value;
if (strEmail.search(validRegExp) == -1)
{
alert(" A valid E-mail is required");
document.getElementById("txtEmail").focus();
return false;
}
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: