Skip to content

Instantly share code, notes, and snippets.

@dev1ne
Created August 2, 2013 19:59
Show Gist options
  • Select an option

  • Save dev1ne/6142954 to your computer and use it in GitHub Desktop.

Select an option

Save dev1ne/6142954 to your computer and use it in GitHub Desktop.
jQuery email validation
function IsEmail(email) {
var regex = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
//m_c1_txtReqEmail
var TempEmail = $('#m_c1_txtReqEmail').val();
if (IsEmail(TempEmail) == false) {
$('#m_c1_txtReqEmail').addClass("error");
error += "\n - Invalid Email Address";
} else {
$('#m_c1_txtReqEmail').removeClass("error");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment