Translate KeyDown keycode to string (jQuery)
<p>I am looking for a way to translate a keypress into the string corresponding to the chracter. Something like this:</p>

<pre><code>$(document).keydown(function(event) {
    console.log(String.fromCharCode(event.which));
});
</code></pre>

<p>except that this code does not take into account capitalization and does not work for special character, e.g. ",". This:</p>

<pre><code>$(document).keypress(function(event) {
    console.log(String.fromCharCode(event.which));
});
</code></pre>

<p>seems to the trick, but it can not prevent default browser actions (such as go back on backspace) and there seem to be browser compatibly issues.</p>

<p>Is there any better way, that works across browsers and keyboard layouts ?</p>
