title: Prevent keypress whilst shift key is held
body: <p>I'm trying to prevent certain keys from being entered into an input box, but only if that particular key is pressed <strong>whilst the <kbd>shift</kbd> key is held</strong>:</p>
  
  <pre><code>$('selector').keydown(function(e) {
    console.log(e.shiftKey);
    if (e.shiftKey &amp;&amp; e.which == 51) {
      e.preventDefault();
      alert('Disallowed');
    }
  });
  </code></pre>
  
  <p>The alert fires but the character still appears in the text box. </p>
  
  <p>I've tried searching around for an explanation as to why this happens but to no avail, any help would be greatly appreciated!</p>
  
  <p><strong>edit</strong></p>
  
  <p>Removing the <code>alert</code> seems to fix the problem (which seems bizarre), I'd really love to know why it behaves in this way though, it doesn't seem to make any sense.</p>
  
  <p>Thanks</p>