I have a form with a text area and hitting the enter key submits my form. How can I make it to add a new line character instead of a form submit.
Previous answers don't handle splitting the current value of the textarea and simply appends a new line character. The following stops the event from bubbling up to the form and still allows typical textarea behavior on 'enter'.
$('textarea').keydown(function(event) {
if (event.keyCode === 13) {
event.stopPropagation();
}
});