Skip to content

Instantly share code, notes, and snippets.

@wwilliams
Created December 23, 2016 19:32
Show Gist options
  • Save wwilliams/2ddd340ad7aca43098cd516d5a5278cb to your computer and use it in GitHub Desktop.
Save wwilliams/2ddd340ad7aca43098cd516d5a5278cb to your computer and use it in GitHub Desktop.
stops form submit on return but allows new line on textarea
$(document).ready(function () {
$(window).keydown(function (event) {
if (event.keyCode == 13 && event.target.nodeName != 'TEXTAREA') {
event.preventDefault();
return false;
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment