title: How to detect if click event has been triggered by 'Enter'?
body: <pre><code>//...
  &lt;a href="#" id="foo-link"&gt;Foo&lt;/a&gt;
  &lt;script type="text/javascript"&gt;
  
    $('#foo-link').click(function(e) {
      //...
    }
  
  &lt;/script&gt;
  //...
  </code></pre>
  
  <p>Using jQuery on a HTML page, the above defined <code>click</code> handler is executed </p>
  
  <ol>
  <li>when the user <strong>clicks</strong> it and </li>
  <li>when the user navigates to it via <strong>Tab</strong> and hits <strong>Enter</strong></li>
  </ol>
  
  <p>(At least in Firefox) there seems to be no difference between the click events passed to the handler - the original key event 'magically' translates to a click event.</p>
  
  <p><strong>Is there a way to differentiate between those two cases?</strong></p>
  
  <p>To give more details on why I need to treat those two cases differently: in my particular case the click handler  sets the focus to a text input field. This text input field has a <code>keyup</code> event handler registered which sends an AJAX request. When the click handler was triggered after the user hitting <strong>Enter</strong> on the link, the <code>keyup</code> event is received by the now focused text input field and the AJAX request is sent mistakenly.</p>