Created
September 24, 2013 09:21
-
-
Save bognerf/6682375 to your computer and use it in GitHub Desktop.
Prevent a form from being sent by hitting return or enter key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Dependency: jQuery | |
$('form').bind("keyup, keypress", function(e) { | |
var code = e.keyCode || e.which; | |
if (code == 13) { | |
e.preventDefault(); | |
return false; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment