SyntaxFix
Write A Post
Hire A Developer
Questions
You shouldn't use the keypress event, but the keyup or 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.
keypress
keyup
keydown