jquery email validation - Web Development and Web Design Codes

Latest

Sunday, February 18, 2018

jquery email validation

jquery email validation

jquery email validation
jquery email validation

Hi friends today we are going to learn how to validate email using jquery..
just follow the below jquery form validation example :how to validation email using jquery.
Copy Below jquery codes to validate email
<script type = "text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type = "text/javascript">
    function ValidateEmail(email) {
        var expr = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
        return expr.test(email);
    };
    $("#btnValidate").live("click", function () {
   var email=$("#txtEmail").val();
   //Checking for Empty Field
 if(email==''){
     $("#result").html("<b style=color:red> This Field Is Mandatory</b>");
 }else{
 //Checking Email is Valid or Not
        if (!ValidateEmail(email)) {
           $("#result").html("<b style=color:red> InValid email address.</b>");
        }
        else {
            $("#result").html("<b style=color:green> Valid email address.</b>");
        }
  }
    });
</script>
<style>
#content{
   width:400px;
   min-height:200px;
   background:#ccc;
   color:black;
   margin:auto;
   overflow:hidden;
}
input[type=text]{
   padding:4px;
   border-radius:4px;
}
input[type=button]{
   padding:4px;
   border-radius:5px;
   font-weight:bold;
}
</style>
<div id="content">
<h2>Jquery Email Validation</h2>
<input type = "text" id = "txtEmail" />
<input type = "button" id = "btnValidate" value = "Validate" />
<div id="result"></div>
</div>

That's it Friends How to Implement Jquery Email Validation System..Keep visiting This Blog for More Codes..Thank You...

No comments:

Post a Comment

Thank You for Your Comment

Note: Only a member of this blog may post a comment.