...

View Full Version : How to do email vaildation in javascript?



Ruriko
05-22-2009, 12:01 PM
How do you create in javascript to do email vaildation? to check

must contain 1 @
must contain 1 letter before the @
must contain 1 letter after the @
must not contain spaces, slash, colon, comma or semicolon

if the any of the rules are wrong it will alert the user saying "Invalid Email"

Philip M
05-22-2009, 12:39 PM
Your conditions are not sufficient to validate an email address.

A proper and complete email validation is:-


if (!(/^([a-z0-9])([\w\.\-\+])+([a-z0-9])\@(([\w\-]?)+\.)+([a-z]{2,4})$/i.test(emailAddress.value))) {
alert ("Invalid email address");
return false;


Tourist in Athens to tour guide: "You have told us something about Byzantine architecture. Would it be possible to meet some Byzants?"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum