files/en-us/web/api/htmlinputelement/index.md
{{APIRef("HTML DOM")}}
The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of {{HTMLElement("input")}} elements.
{{InheritanceDiagram}}
Also inherits properties from its parent interface, {{domxref("HTMLElement")}}.
Some properties only apply to input element types that support the corresponding attributes.
{{domxref("HTMLInputElement.align", "align")}} {{Deprecated_Inline}}
{{domxref("HTMLInputElement.alpha", "alpha")}} {{experimental_inline}}
alpha attribute, indicating whether the color's alpha component can be manipulated by the end user and does not have to be fully opaque.{{domxref("HTMLInputElement.colorSpace", "colorSpace")}}
colorspace attribute, indicating the {{glossary("color space")}} of the serialized CSS color (sRGB or display-p3).{{domxref("HTMLInputElement.defaultValue", "defaultValue")}}
{{domxref("HTMLInputElement.dirName", "dirName")}}
{{domxref("HTMLInputElement.incremental", "incremental")}} {{Non-standard_Inline}}
true, fires on every keypress, or on clicking the cancel button; otherwise fires when pressing <kbd>Enter</kbd>.{{domxref("HTMLInputElement.labels", "labels")}} {{ReadOnlyInline}}
{{domxref("HTMLInputElement.list", "list")}} {{ReadOnlyInline}}
list attribute. The property may be null if no HTML element is found in the same tree.{{domxref("HTMLInputElement.multiple", "multiple")}}
multiple attribute, indicating whether more than one value is possible (e.g., multiple files).{{domxref("HTMLInputElement.name", "name")}}
name attribute, containing a name that identifies the element when submitting the form.{{domxref("HTMLInputElement.popoverTargetAction", "popoverTargetAction")}}
"hide", "show", or "toggle") on a popover element being controlled by an {{HTMLElement("input")}} element of type="button". It reflects the value of the popovertargetaction HTML attribute.{{domxref("HTMLInputElement.popoverTargetElement", "popoverTargetElement")}}
type="button". The JavaScript equivalent of the popovertarget HTML attribute.{{domxref("HTMLInputElement.step", "step")}}
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.{{domxref("HTMLInputElement.type", "type")}}
{{domxref("HTMLInputElement.useMap", "useMap")}} {{Deprecated_Inline}}
{{domxref("HTMLInputElement.value", "value")}}
{{domxref("HTMLInputElement.valueAsDate", "valueAsDate")}}
null if conversion is not possible.{{domxref("HTMLInputElement.valueAsNumber", "valueAsNumber")}}
NaN if conversion is impossible.{{domxref("HTMLInputElement.form", "form")}} {{ReadOnlyInline}}
{{domxref("HTMLInputElement.formAction", "formAction")}}
formaction attribute, containing the URL of a program that processes information submitted by the element. This overrides the action attribute of the parent form.{{domxref("HTMLInputElement.formEnctype", "formEnctype")}}
formenctype attribute, containing the type of content that is used to submit the form to the server. This overrides the enctype attribute of the parent form.{{domxref("HTMLInputElement.formMethod", "formMethod")}}
formmethod attribute, containing the HTTP method that the browser uses to submit the form. This overrides the method attribute of the parent form.{{domxref("HTMLInputElement.formNoValidate", "formNoValidate")}}
formnovalidate attribute, indicating that the form is not to be validated when it is submitted. This overrides the novalidate attribute of the parent form.{{domxref("HTMLInputElement.formTarget", "formTarget")}}
formtarget attribute, containing a name or keyword indicating where to display the response that is received after submitting the form. This overrides the target attribute of the parent form.{{domxref("HTMLInputElement.disabled", "disabled")}}
{{domxref("HTMLInputElement.required", "required")}}
required attribute, indicating that the user must fill in a value before submitting a form.{{domxref("HTMLInputElement.validationMessage", "validationMessage")}} {{ReadOnlyInline}}
false), or it satisfies its constraints. This value can be set by the {{domxref("HTMLInputElement.setCustomValidity()", "setCustomValidity()")}} method.{{domxref("HTMLInputElement.validity", "validity")}} {{ReadOnlyInline}}
{{domxref("HTMLInputElement.willValidate", "willValidate")}} {{ReadOnlyInline}}
false if any conditions bar it from constraint validation, including: its type is one of hidden, reset or button, it has a {{HTMLElement("datalist")}} ancestor or its disabled property is true.{{domxref("HTMLInputElement.checked", "checked")}}
{{domxref("HTMLInputElement.defaultChecked", "defaultChecked")}}
{{domxref("HTMLInputElement.indeterminate", "indeterminate")}}
checked attribute, and clicking the checkbox will set the value to false.{{domxref("HTMLInputElement.alt", "alt")}}
alt attribute, containing alternative text to use.{{domxref("HTMLInputElement.height", "height")}}
height attribute, which defines the height of the image displayed for the button.{{domxref("HTMLInputElement.src", "src")}}
src attribute, which specifies a URI for the location of an image to display on the graphical submit button.{{domxref("HTMLInputElement.width", "width")}}
width attribute, which defines the width of the image displayed for the button.{{domxref("HTMLInputElement.accept", "accept")}}
accept attribute, containing comma-separated list of file types that can be selected.{{domxref("HTMLInputElement.capture", "capture")}}
capture attribute, indicating the media capture input method in file upload controls.{{domxref("HTMLInputElement.files", "files")}}
{{domxref("HTMLInputElement.webkitdirectory", "webkitdirectory")}}
webkitdirectory attribute. If true, the file-system-picker interface only accepts directories instead of files.{{domxref("HTMLInputElement.webkitEntries", "webkitEntries")}} {{ReadOnlyInline}}
{{domxref("HTMLInputElement.autocomplete", "autocomplete")}}
autocomplete attribute, indicating whether the value of the control can be automatically completed by the browser.{{domxref("HTMLInputElement.max", "max")}}
{{domxref("HTMLInputElement.maxLength", "maxLength")}}
maxlength attribute, containing the maximum number of characters (in Unicode code points) that the value can have.{{domxref("HTMLInputElement.min", "min")}}
{{domxref("HTMLInputElement.minLength", "minLength")}}
minlength attribute, containing the minimum number of characters (in Unicode code points) that the value can have.{{domxref("HTMLInputElement.pattern", "pattern")}}
pattern attribute, containing a regular expression that the control's value is checked against. Use the title attribute to describe the pattern to help the user. This attribute only applies when the value of the type attribute is text, search, tel, url or email.{{domxref("HTMLInputElement.placeholder", "placeholder")}}
placeholder attribute, containing a hint to the user of what can be entered in the control. The placeholder text must not contain carriage returns or line-feeds. This attribute only applies when the value of the type attribute is text, search, tel, url or email.{{domxref("HTMLInputElement.readOnly", "readOnly")}}
{{domxref("HTMLInputElement.selectionDirection", "selectionDirection")}}
forward (the selection was performed in the start-to-end direction of the current locale), backward (the opposite direction) or none (the direction is unknown).{{domxref("HTMLInputElement.selectionEnd", "selectionEnd")}}
{{domxref("HTMLInputElement.selectionStart", "selectionStart")}}
{{domxref("HTMLInputElement.size", "size")}}
Also inherits methods from its parent interface, {{domxref("HTMLElement")}}.
{{domxref("HTMLInputElement.checkValidity()", "checkValidity()")}}
false if the element is a candidate for constraint validation, and it does not satisfy its constraints. In this case, it also fires an {{domxref("HTMLInputElement/invalid_event", "invalid")}} event at the element. It returns true if the element is not a candidate for constraint validation, or if it satisfies its constraints.{{domxref("HTMLInputElement.reportValidity()", "reportValidity()")}}
checkValidity() method, and if it returns false (for an invalid input or no pattern attribute provided), then it reports to the user that the input is invalid in the same manner as if you submitted a form.{{domxref("HTMLInputElement.select()", "select()")}}
{{domxref("HTMLInputElement.setCustomValidity()", "setCustomValidity()")}}
{{domxref("HTMLInputElement.setRangeText()", "setRangeText()")}}
{{domxref("HTMLInputElement.setSelectionRange()", "setSelectionRange()")}}
{{domxref("HTMLInputElement.showPicker()", "showPicker()")}}
{{domxref("HTMLInputElement.stepDown()", "stepDown()")}}
{{domxref("HTMLInputElement.stepUp()", "stepUp()")}}
Also inherits events from its parent interface, {{domxref("HTMLElement")}}.
Listen to these events using {{domxref("EventTarget.addEventListener", "addEventListener()")}} or by assigning an event listener to the oneventname property of this interface:
type="search".{{Specifications}}
{{Compat}}