Skip to content

Instantly share code, notes, and snippets.

@epierpont
Last active August 29, 2015 14:16
Show Gist options
  • Save epierpont/075d899e290652fec5f9 to your computer and use it in GitHub Desktop.
Save epierpont/075d899e290652fec5f9 to your computer and use it in GitHub Desktop.
JS - Simple jQuery email validation
// validate email address from form, good for email newsletter signup
$( 'form input.submit' ).click(function() {
var email_address = $( 'form input.email' ).val();
if ( /(.+)@(.+){2,}\.(.+){2,}/.test( email_address ) ) {
return true;
} else {
alert( 'Invalid Email Address' );
return false;
}
});
@earthjibber
Copy link

Dear eric

This is super neat

The End

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment