Dark

Light

Dark

Light

How to validate email using jQuery?

To validate email using jQuery, use the regex pattern. You can try to run the following code to learn how to validate email using jQuery :

Function:

function validateEmail($email) {
  var emailReg = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  return emailReg.test( $email );
}

Usage:

if( !validateEmail(useremail)) { 
alert("Please enter a valid email!");
return false;
}

Post a comment

Your email address will not be published. Required fields are marked *