When using the example code from the jQuery documentation for the keypress event handler, I'm unable to capture the Delete key. The snippet below is going to log
You shouldn't use the
keypress event, but the
keydown event because the
keypress event is intended for real (printable) characters.
keydown is handled at a lower level so it will capture all nonprinting keys like delete and enter.