key


keystringRead-only

Gets a string representation of the key that was pressed.

For keys representing a printable character, the key property gets a Unicode character string containing the printable representation of the key that was pressed. This does not necessarily correspond to what is printed on the physical key since the user could have changed the keyboard layout.

For keys that have no printable representation, a string indicating the key's purpose is returned. Some examples are:

  • "Backspace"
  • "Enter"
  • "F1"
  • "Escape"
  • "Tab"
Did this help?