jQuery trigger() and stopPropagation() on keydown event
问题 I am having a difficult time with keydown and stop propagation i do not want my page to refresh, i have tried every which way i can think of, my current code is <script> $(document).ready(function() { var e = jQuery.event( 'keydown', { which: $.ui.keyCode.ENTER } ); $('#id_number').trigger(e, function(event){ event.preventDefault(); event.stopPropagation(); }); }); </script> any idea on what i am doing wrong here? I thought that the event was called correctly, i have jquery and jquery ui