DOM HTMLInputElement Interface
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
| Name | Description |
|---|---|
HTMLInputElement.checked | The checked property gets or sets whether a checkbox or radio button is ticked. |
HTMLInputElement.value | The value property gets or sets the current value of an input field, such as the text a user has typed. |
Example
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.
Desktop





Tablets & Mobile





