title: How to trigger enter event with jquery
body: <p>I have the following which works:</p>
  
  <pre><code>$('textarea').keypress(function(e) {
      if (e.keyCode == '13') {
          alert('code');
      }
  });
  </code></pre>
  
  <p>But I want to trigger that same thing when the page loads, I tried the following but it doesn't work:</p>
  
  <pre><code>var e = jQuery.Event("keypress");
  e.which = 13; // Enter
  $('textarea').trigger(e);
  </code></pre>
  
  <p>NOTE: I want to have the first snipped of code there, I DO NOT want to remove it.</p>