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.
$(document).ready(function() { $('textarea').keydown(function(event){ if (event.keyCode == 13) { event.preventDefault(); var s = $(this).val(); $(this).val(s+"\n"); } }); });