Why Isn't Backspace Being Detected Using Jquery Keypress Event?
Why isn't backspace being detected using jquery keypress event? $('#field').keypress(function(event){alert(event.which);});
Solution 1:
Try using keydown
and keyup
functions instead for IE.
Solution 2:
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.
Solution 3:
The onKeyUp alone will do all the keyboard key detection in chrome..
Post a Comment for "Why Isn't Backspace Being Detected Using Jquery Keypress Event?"