Account
Categories

Keyboard Events and Its Types


Definition:

When you press a key on the keyboard and an action happens, it is called a keyboard event.

Keyboard events usually occur on the following HTML elements:

  • <input type="text"> → for typing text
  • <input type="password"> → for entering passwords
  • <textarea> → for writing multi-line text
  • <input type="search"> → for search boxes

Types of Keyboard Events:

  1. onkeydown
  2. onkeyup
  3. onkeypress