Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

jQuery- Email Validation

Article:
Viewed:  680 
Posted On:  8/17/2016 2:17:50 AM 
How can we validate email in asp.net using jQuery? 

 

In ASP.Net how we can validate an email address field using jQuery.

<script>

        $(document).ready(function () {
            function ValidateEmail(email) {
                var expr = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
                return expr.test(email);
            };
  
            //New Registration
            $("#MakeRegister").click(function () {
                var email = $('#email').val();
                  
                    if (!ValidateEmail($("#email").val())) {
                        alert("Invalid email address.");

return false;
                    }
                }
            });
 
    </script>

  Comment:
 
By Divya  On  6/21/2017 3:53:12 AM
The above code is not working for me.. Will u please clarify mydoubt.. #MakeRegister - button id , #email - text box id... Is it correct?
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us