I've one form in that having some inputs as well as textarea like below.
<form id="my_form" action="/action_page.php">
  First name:<br>
  <input type="text" name="firstname">
  <br>
  Last name:<br>
  <input type="text" name="lastname">
  <br>
  Note:<br>
  <textarea id="note" name="note"></textarea>
  <br>
  <input type="submit" value="Submit">
</form> 
I've to disable form submission on pressing Enter key. Form should be submitted only on click of submit button.
I found this solution on stackoverflow, so I wrote below code.
$("#my_form").keypress( function( e ) {
    var code = e.keyCode || e.which;
    if ( code == 13 ) {
        e.preventDefault();
        return false;
    }
});
It's working fine but not allowing newline to be entered in the textarea on pressing Enter key. How do I achieve this?
 
     
     
     
     
     
    