Created
June 23, 2016 00:52
-
-
Save malpaso/c82d38e349861d093926a9be00a4a372 to your computer and use it in GitHub Desktop.
Prevent form submitting on Enter key (jQuery)
This file contains hidden or 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
$(function() { | |
$('#formId').on('keyup keypress', function(e) { | |
var keyCode = e.keyCode || e.which; | |
if (keyCode === 13) { | |
e.preventDefault(); | |
return false; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment