Skip to content

Instantly share code, notes, and snippets.

@alexhaller
Created August 4, 2015 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexhaller/fc71f1102317eac17b73 to your computer and use it in GitHub Desktop.
Save alexhaller/fc71f1102317eac17b73 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
$('#registerform').find(':submit').click(function(e) {
if( ! isAllowedEmail( $('#user_email').val() ) ) {
e.preventDefault(); // Prevent the form from submitting
alert('You can only register with an @gmail.com email address!');
return false;
}
});
});
function isAllowedEmail( address ) {
return address.indexOf("@gmail.com", this.length - 10) !== -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment