Why isn\'t backspace being detected using jquery keypress event?
$(\"#field\").keypress(function(event){alert(event.which);});
Try using keydown
and keyup
functions instead for IE.
Javascript e.keyCode doesn't catch Backspace/Del in IE
The onKeyUp alone will do all the keyboard key detection in chrome..
The "keypress" event is (in its original IE form, and in Safari/Chrome) about an actual character being added to a text field. The backspace key clearly does not add a new character to the field value, so it causes no keypress event.
Firefox and Opera are a little more willy-nilly about generating typing events.
PPK (quirksmode) considers the IE and Webkit behaviors to be the sensible ones, and I pretty much agree.