onKeyPress event in Firefox and IE8

When problems like this show up, I start to use any kind of a JavaScript framework. Those frameworks are build to avoid problems with different browsers.

To catch all different keypress() apis, like the link from Emmett shows, can be very difficult.

Example:

In HTML head:

<script src="http://code.jquery.com/jquery-1.4.4.js"></script>

In the JS tag:

$(document).keydown(function(event) {
 alert('You pressed '+event.keyCode);
 event.preventDefault();
});

Leave a Comment