← CodePrimer
JavaScript Beginner Dom

Live input event

How do I react as the user types?

input event for live updates.

Sample
const field = document.querySelector('#bio');
const counter = document.querySelector('#count');
field.addEventListener('input', () => {
  counter.textContent = String(field.value.length);
});

Notes

input fires on every change; change fires after blur/commit.

Keywords: input · keyup · live · counter

Related

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share