views:

193

answers:

2

I've got a simple javascript keydown event coded via jquery. The event should just alert the key that is "down." This works for most keys but not the backspace key in Internet Explorer. I read that IE messes this up on the keypress event but was supposed to work for the keydown and keyup events.

Is there anything I can do via jquery to capture the backspace in IE? The version of IE I'm currently testing in is:

8.0.7600.16385

        $('.AddressField').bind("keydown", function (e) {
            alert(e.keyCode);
        });
A: 

keyCode property is not available in IE. In IE you must use which property.

Strelok
+1  A: 

use which:

  $('.AddressField').keypress(function(e){
       alert(e.which);
   });
Garis Suero
Why does IE make things so difficult :-( Thanks, this worked great. I'm checking keyCode and which at this point just to be sure.
Justin808