Entry
Can I capture the Delete key?
Jan 27th, 2007 03:04
Steve White, Martin Honnen,
All browsers are different on this point. In some cases it's not possible.
Opera 9.1 -- no keyPress. keyDown 46.
unfortunately, indistinguishable from the "." key event.
Konqueror keyCode 127 (ASCII DEL) keyPress: event.charCode=0, which=127
also keyDown
NN6 is leading here as it fires onkeydown, onkeypress, and onkeyup for
the delete key. You can check
event.which == 46
to find that key.
IE5 is firing onkeydown and onkeyup but not onkeypress for the delete
key. You can check
event.keyCode == 46
to find the key.
Finally NN4 seems to fire only onkeyup for the delete key but
unfortunately
event.which
is 0 in that case which makes it impossible to recognize the key.