The keypress
event is fired when a key is pressed down and that key normally produces a character value (use input
instead).
General info
- Specification
- DOM L3 {{deprecated_inline()}}
- Interface
- KeyboardEvent
- Bubbles
- Yes
- Cancelable
- Yes
- Target
- Document, Element
- Default Action
- Varies:
keypress
event; launch text composition system;blur
andfocus
events;DOMActivate
event; other event
Properties
{{OpenEventProperties()}}{{UIEventProperties()}}{{KeyboardEventProperties()}}{{ModifiersEventProperties()}}{{CloseEventProperties()}}
Notes
Chrome does not fire the keypress
event for known keyboard shortcuts (reference). Which keyboard shortcuts are known depends on the user's system. Use the keydown
event to implement keyboard shortcuts.
Related Events
{{KeyRelatedEvents()}}