Validate Email Address Using JavaScript

Following code used to validate the email address.


 
function IsEmail(email) {
     var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]  {2,4})+$/;
    return regex.test(email);
}
Example :
We can test email address by above function like :
This function return boolean value , it will return either true or false based on the validation test.
If user has supplied wrong email address then it  will return false otherwise return true.

 
 IsEmail("chauhanvipul87@gmail.com"); -->    output : true
 IsEmail("chauhan.com")               -->    output : false

posted under |

0 comments:

Post a Comment

Please provide your valuable comment.

Newer Post Older Post Home

Followers

Powered by Blogger.

Populares

Custom Search