DOM HTMLElement: input event
The input event fires every time the value of an input, textarea, select or contenteditable element changes.
Description
The input event fires every time the value changes in an <input>, <select> or <textarea>, or in an element with contenteditable. It covers typing, pasting, dragging text, autofill and voice input, which makes it better than keyboard events for live features like search-as-you-type and character counters. It bubbles, so one listener on a form can handle every field.
The event object is an InputEvent for text fields, with inputType describing what happened, such as "insertText" or "deleteContentBackward", and data containing the inserted text. For checkboxes and selects, the value change is immediate, so input and change fire together.
For live searches that send requests, combine the input event with a short debounce using setTimeout(), so a request is only made once the user pauses typing. It bubbles, so a single listener on a common ancestor, such as a form or the document, can handle it for many elements, using event.target to tell them apart.
Syntax
element.addEventListener('input', handler)Example
Browser Support
The following information will show you the current browser support for the HTMLElement: input event event. Hover over a browser icon to see the version that first introduced support for this event.
Desktop





Tablets & Mobile





