keypress function rus only with enter key (e.which==13)
<p>This is my first post here.
After a few weeks reading and learning here I have a specific question:</p>

<pre><code>$(document).keypress(function(e) {
  if (e.which == 13) { alert('Key press') }; 
});
</code></pre>

<p>This runs perfectly; an alert box is shown.</p>

<p>When I try with ESC (code 27) or any other key code, it doesn't run.
Any suggestions?</p>
