How to validate email using jQuery?

Picture of Amitpal Singh
Amitpal Singh
August 3, 2020

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;
}

Share this post:

How to Attribute?

Lorem ipsum is typically a corrupted version of De finibus bonorum et malorum, a 1st-century BC text by the Roman statesman and philosopher Cicero.
for Example: Website, Social Media, Blogs, ebooks , newsletter, etc.
Lorem ipsum is typically a corrupted version of De finibus bonorum et malorum, a 1st-century BC text by the Roman statesman and philosopher Cicero.
Copied!

Got a Question? Check out our FAQ Section.

Your action, our appreciation

It encourage us to give you more valuable content on website.