HTMLInputElement

Baseline
Widely available
*

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

* Some parts of this feature may have varying levels of support.

The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements.

EventTarget Node Element HTMLElement HTMLInputElement

Instance properties

Also inherits properties from its parent interface, HTMLElement.

Some properties only apply to input element types that support the corresponding attributes.

align

A string that represents the alignment of the element. Use CSS instead.

alpha

A boolean that represents the element's alpha attribute, indicating whether the color's alpha component can be manipulated by the end user and does not have to be fully opaque.

colorSpace

A string that represents the element's colorspace attribute, indicating the color space of the serialized CSS color (sRGB or display-p3).

defaultValue

A string that represents the default value as originally specified in the HTML that created this object.

dirName

A string that represents the directionality of the element.

incremental

A boolean that represents the search event fire mode, if true, fires on every keypress, or on clicking the cancel button; otherwise fires when pressing Enter.

labels Read only

Returns a list of <label> elements that are labels for this element.

list Read only

Returns the element pointed to by the list attribute. The property may be null if no HTML element is found in the same tree.

multiple

A boolean that represents the element's multiple attribute, indicating whether more than one value is possible (e.g., multiple files).

name

A string that represents the element's name attribute, containing a name that identifies the element when submitting the form.

popoverTargetAction

Gets and sets the action to be performed ("hide", "show", or "toggle") on a popover element being controlled by an <input> element of type="button". It reflects the value of the popovertargetaction HTML attribute.

popoverTargetElement

Gets and sets the popover element to control via an <input> element of type="button". The JavaScript equivalent of the popovertarget HTML attribute.

step

A string that represents the element's step attribute, which works with min and max to limit the increments at which a numeric or date-time value can be set. It can be the string any or a positive floating point number. If this is not set to any, the control accepts only values at multiples of the step value greater than the minimum.

type

A string that represents the element's type attribute, indicating the type of control to display. For possible values, see the documentation for the type attribute.

useMap

A string that represents a client-side image map.

value

A string that represents the current value of the control. If the user enters a value different from the value expected, this may return an empty string.

valueAsDate

A Date that represents the value of the element, interpreted as a date, or null if conversion is not possible.

valueAsNumber

A number that represents the value of the element, interpreted as one of the following, in order: A time value, a number, or NaN if conversion is impossible.

form Read only

Returns a reference to the parent <form> element.

formAction

A string that represents the element's