email validation javascript
Posted
by fusion
on Stack Overflow
See other posts from Stack Overflow
or by fusion
Published on 2010-05-06T18:59:12Z
Indexed on
2010/05/06
19:08 UTC
Read the original article
Hit count: 439
is this javascript function (checkValidity) correct?
function checkTextBox(textBox)
{
if (!checkValidity(textBox.getValue()))
displayError("Error title", "Error message", textBox);
textBox.focus();
}
function checkValidity(e)
{
var email;
email = "/^[^@]+@[^@]+.[a-z]{2,}$/i";
if (!e.match(email)){
return false;
else
return true;
}
}
© Stack Overflow or respective owner