Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Email validation in javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 153
    Comment on it

    If you are creating web forms then you need to put the validation in your form. We are here to discuss the validation for email. We know email address has its own structure. For eg. anytext@domain-main.com or anytext@domain-name.co etc

    We are going to share a script in javascript for email validation. Please have a look.

    <html>
    <head>
    <script>
    function customerData(){
    var email_id = document.getElementById('customer_email').value;
    var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
    if (filter.test(email_id)){
        return true;
    }
    else{
        alert('Kindly fill out the correct email address');
        return false;
    }
    }
    </script>
    </head>
    <body>
    <form method="post" onsubmit="return customerData();">
    <input type="text" name="customer_email" id="customer_email" placehoder="Enter your email address" />
    <input type="submit" name="process_user" />
    </form>
    </body>
    </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: