Web APIs

input event

Try the free JavaScript compiler

Typically fires as a user changes a control’s value. Programmatic value assignment does not automatically emit it.

Formal Syntax & Structure

javascript syntaxjavascript
control.addEventListener("input", callback)

Working Example

Example Snippetjavascript
const i=document.createElement("input");let n=0;i.addEventListener("input",()=>n++);i.value="new";console.log(n);i.dispatchEvent(new Event("input"));console.log(n);
JavaScript Reference