Email Validation In javascript

email validation in javascript or mail validation in javascript here we are provide a demo of
email validation in javascript




code :

<script>
function emailvalidation(){ 
   var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 
   email = document.getElementById('email').value ;
   if(emailPattern.test(email)==false){
   alert('please Enter Valid Email Id');
    document.getElementById('email').focus();
    return false ;
   }
 }
 </script>

 <form >
 <label> Email Id : </label>
 <input type="text" name="email" value="please enter email id " id="email" onclick="(this.value='')"  />
 <input type="submit" name="button" value="Chick Email" onclick="return emailvalidation()"  />
 </form>



Comments

Popular posts from this blog

Call PHP Function In JavaScript Using Ajax

List of Post Category Wise in wordpress