Favorites

DOM HTMLInputElement Interface

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
HTMLInputElement
DOM InterfaceThis interface is supported by all modern browsers.
Updated 28th November 2026

HTMLInputElement represents an input element. It provides properties such as value, checked and validity, and methods for selecting text and checking validation.

Description

The HTMLInputElement interface represents an <input> element and provides properties and methods for working with it. The most used are value (the current text), checked (for checkboxes and radios), type, disabled, files (for file inputs), valueAsNumber and valueAsDate.

For validation it offers validity, validationMessage, checkValidity(), reportValidity() and setCustomValidity(), and for text selection select() and setSelectionRange(). The input event fires as the value changes and change fires when a change is committed.

The type attribute changes which properties and methods are relevant: checked for checkboxes and radios, files for file inputs, valueAsDate for date inputs, and stepUp() and stepDown() for numbers and ranges. Setting value in script doesn't fire the input or change events, so trigger any related updates yourself, or dispatch an event if other code is listening.

Inheritance

HTMLInputElement inherits properties and methods from HTMLElement.

Properties

NameDescription
HTMLInputElement.checkedThe checked property gets or sets whether a checkbox or radio button is ticked.
HTMLInputElement.valueThe value property gets or sets the current value of an input field, such as the text a user has typed.

Example

<label>Quantity <input id="qty" type="number" min="1" max="10" value="3"></label>
const qty = document.getElementById('qty');
console.log(qty.type, qty.value, qty.valueAsNumber + 1);
qty.value = 20;
console.log(qty.checkValidity(), qty.validationMessage);
qty.addEventListener('input', () => console.log('Now', qty.value));

Browser Support

The following information will show you the current browser support for the HTMLInputElement interface. Hover over a browser icon to see the version that first introduced support for this interface.

This interface is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee