Published on

Keyboard Events in JavaScript

Authors
  • avatar
    Name
    hwahyeon
    Twitter
Event TypeTriggerFeatures
keydownWhen a key is pressed· Responds to all keys (letters, numbers, special keys, control keys)
· Repeats while key is held down
· Detects special keys
keypressWhen a key is pressed· Responds to printable characters and some control keys (e.g., Enter, Tab)
· Does not detect modifier keys (e.g., Shift, Ctrl)
· Deprecated and not recommended for use; use keydown instead
keyupWhen a key is released· Responds to all keys (letters, numbers, special keys, control keys)
· Detects when a key is released
· Useful for verifying input or resetting state