Press any key on your keyboard

Common Questions (FAQ)

What is event.key?

The value of the key pressed, accounting for modifiers (e.g. Shift) and keyboard layout.

What is event.code?

Represents the physical key on the keyboard. It ignores layout language.

Why is event.which deprecated?

It is non-standard and inconsistent. Use event.key or event.code instead.

What are modifier keys?

Keys like Shift, Ctrl, Alt, and Meta (Command) that modify the action of another key.

Difference between keyCode and key?

keyCode is a numeric code (deprecated), while key is the actual value produced (e.g., 'a' vs 'A').

v1.1