title: jQuery trigger() and stopPropagation() on keydown event
body: <p>I am having a difficult time with keydown and stop propagation</p>
  
  <p>i do not want my page to refresh, i have tried every which way i can think of, my current code is</p>
  
  <pre><code> &lt;script&gt;
   $(document).ready(function() {
   var e = jQuery.event( 'keydown', { which: $.ui.keyCode.ENTER } );
  
   $('#id_number').trigger(e, function(event){
  event.preventDefault();
  event.stopPropagation();
  });
  
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>any idea on what i am doing wrong here? I thought that the event was called correctly, i have jquery and jquery ui linked correctly and receive no console errors</p>
  
  <p><strong>UPDATE</strong>
  well it was working, now im getting 
  Property 'event' of object function (a,b){return new e.fn.init(a,b,h)} is not a function 
  error on the below code</p>
  
  <pre><code> $(document).ready(function() {
   var e = jQuery.event( 'keydown', { which: $.ui.keyCode.ENTER } , function(event){
    event.preventDefault();
    event.stopPropagation();
  }); 
  
   $('#id_number').trigger(e);
  
   });
  </code></pre>
  
  <p><strong>UPDATE #2 - fixed</strong></p>
  
  <p>things I learned</p>
  
  <ol>
  <li>trigger() not needed in the document(ready)</li>
  <li>getting $.ui.keyCode to work was difficult (at least for me)</li>
  <li>always see what other functions are attached to the input (onblur, onfocus, ect) aka doh</li>
  </ol>
  
  <p>rewrote it to this, works perfectly fine</p>
  
  <pre><code> $(document).ready(function() {
      $('#id_number').keydown(OnKeyDown);
   });    
  
  function OnKeyDown(e){
  var code = (e.keyCode ? e.keyCode : e.which); //to support both methods
  if(code == 13) { //the Enter keycode
  
      //my actions
   return false;
   }
  }
  </code></pre>