title: .keyCode vs. .which
body: <p>I thought this would be answered somewhere on Stack Overflow, but I can’t find it.</p>
  
  <p>If I’m listening for a keypress event, should I be using <code>.keyCode</code> or <code>.which</code> to determine if the Enter key was pressed?</p>
  
  <p>I’ve always done something like the following:</p>
  
  <pre><code>$("#someid").keypress(function(e) {
    if (e.keyCode === 13) {
      e.preventDefault();
      // do something
    }
  });
  </code></pre>
  
  <p>But I’m seeing examples that use <code>.which</code> instead of <code>.keyCode</code>. What’s the difference? Is one more cross-browser friendly than the other?</p>