title: Enter key press event for document with a drop-down list
body: <p>I have a html with more than one select drop down list and input. When the <kbd>enter</kbd> key is pressed, I want to call a button trigger function, but when I press down list, its not called any event function. I tried to button <code>type =&quot;submit&quot;</code> but it not working.</p>
  <p>How do I calling trigger function when the <kbd>enter</kbd> key is pressed?</p>
  <p>The following code works for selectbox, but it does not work for dropdown.</p>
  <pre><code>jQuery(document).keypress(function (e) {
  
      if (e.key == &quot;Enter&quot;) {
          $(&quot;#button&quot;).trigger('click');
          e.key = null;
      }
  });
  </code></pre>
  <p>or</p>
  <pre><code> jQuery(document).keypress(function (e) {
  
   if (e.which == 13) {
           $(&quot;#button&quot;).trigger('click');
          return false;
     }
  });
  </code></pre>