Email validation using jQuery

DuH picture DuH · Mar 24, 2010 · Viewed 868k times · Source

I'm new to jQuery and was wondering how to use it to validate email addresses.

Answer

Fabian picture Fabian · Mar 24, 2010

You can use regular old javascript for that:

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