Showing posts with label Validate email address using jQuery. Show all posts
Showing posts with label Validate email address using jQuery. Show all posts

Wednesday, 23 April 2014

Email Validation in Jquery

Email Validation in Jquery

Put this function checkEmail(email)

function checkEmail(email)
{
    //regular expression for email
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
   
if(pattern.test(email)){
        return true;
    } else {
        return false;
    }
}

For Example :  checkEmail(email_id)