title: KeyPress malfunction in Opera
body: <p>I'm using the following code to detect users' key pressing, in JavaScript:</p>
  
  <pre><code>$(document).bind('keydown', function (event) {
      'use strict';
      var keyCode = event.keyCode;
  
          switch (keyCode) {
          case '{N}':
               doSomething();
               break;
  
          default:
               break;
          }
  });
  </code></pre>
  
  <p>Where <code>doSomething</code> is a previously defined function and <code>{N}</code> is any of the <a href="http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes" rel="nofollow">JavaScript Char Codes</a>.</p>
  
  <p>It works properly in every major browser, but in <a href="http://www.opera.com/" rel="nofollow">Opera</a> even if a key remains pressed, it only calls <code>doSomething</code> once, instead of doing it <strong>until</strong> the key is released.
  What can I do to fix this?</p>
  
  <hr>
  
  <h2>Edit</h2>
  
  <p>I solved it using the <code>keypress</code> event instead of <code>keydown</code> (which is not well handled by Opera).</p>