Possible Duplicate:
Which keycode for escape key with jQuery
This little piece of code works like a charm for Firefox and Opera.
Internet Explorer doesn’t like it.
window.document.onkeydown = function (e) {
if (!e) {
e = event;
}
if (e.keyCode == 27) {
myfunction();
}
}
Isn’t it possible to detect keydown for ESC in IE?
Thanks
Which version of IE do you have?
This code works for me with IE (9.01):
Check also your Doctype, your IE could use the Quirks mode, maybe.