Skip to content

Instantly share code, notes, and snippets.

@jupegarnica
Last active December 11, 2015 07:58
Show Gist options
  • Save jupegarnica/4569462 to your computer and use it in GitHub Desktop.
Save jupegarnica/4569462 to your computer and use it in GitHub Desktop.
Prevent Users from submitting form by hitting enter
//Prevent Users from submitting form by hitting enter
//http://stackoverflow.com/questions/895171/prevent-users-from-submitting-form-by-hitting-enter
$(document).ready(function() {
$(window).keydown(function(event){
if(event.keyCode == 13) {
event.preventDefault();
return false;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment