To fix issues in IE6 and IE7, try this ...
$(function()
{
$(document).keydown(function(event){
alert(event.keyCode);
});
});
Attaching the event to $(document)seems magical here.
Your first bit of code should really work in IE too. This seems to be a bug in jQuery, which I hope will be fixed soon ...
Here is the link to the jQuery bug report. https://bugs.jquery.com/ticket/3614
source
share