Name
HTMLElement.onkeypress: event handler invoked when the user presses a key — DOM Level 0
Synopsis
Function onkeypress
Description
The onkeypress property of
an HTMLElement object specifies an event-handler function that is
invoked when the user presses and releases a key while the element
has the keyboard focus. A keypress event is generated after a
keydown event and before the corresponding keyup event. The keypress
and keydown events are similar, although a keypress event is often
more useful for alphanumeric keys, and a keydown handler can be more
useful for function keys.
Determining which key was pressed and what modifier keys were in effect at the time is somewhat complex and browser-dependent. See Chapter 17 for details.
See Also
HTMLElement.onkeydown;
Chapter 17
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access