LOGBOOK

HELP

Quiz Entry - updated: 2026.07.14

What's the difference between input and change events?

input fires on every keystroke/modification, while change fires only once the field loses focus (immediately for checkboxes and selects).

Event When it fires Use case
input Every keystroke/modification Real-time validation, live preview
change When field loses focus Final value, expensive operations

Example:

const field = document.querySelector("input");

field.addEventListener("input", () => {
    // Every keystroke
    console.log("Input:", field.value);
});

field.addEventListener("change", () => {
    // When focus leaves
    console.log("Change:", field.value);
});

Typing "hello" then clicking elsewhere:

Input: h
Input: he
Input: hel
Input: hell
Input: hello
// Only once, at the end
Change: hello

Note: For checkboxes and select elements, change fires immediately on selection.

From Quiz: WEBT / Frontend | Updated: Jul 14, 2026