Event listener

A function that runs when something happens on the page: a click, a key press, a form submit.

JavaScript

Example

document.addEventListener('keydown', e => {
  if (e.key === '/') searchBox.focus();
});

That is how the Lexikon search reacts to the / key.

Related

← DOM Updated 2026-11-26 JSON →