Name

Input — an HTML <input> element

Inherits from

Node, Element, FormControl

Synopsis

An Input object represents an HTML form <input> element. Its appearance and behavior depends on its type attribute: an Input element might represent a simple text input field, a checkbox, a radio box, a button, or a file selection element, for example. Because an <input> element can represent so many kinds of form controls, the Input element is one of the most complicated. See HTML Forms for an overview of HTML forms and form elements. Note that some of the important properties of the Input element (such as type, value, name, and form) are documented in FormControl.

Properties

In addition to the properties listed here, Input elements also implement all of the properties defined by Element and FormControl. The properties marked with an asterisk in this list are newly defined by HTML5 and are not yet, at the time of this writing, widely implemented.

string accept

When type is “file”, this property is a comma-separated list of MIME types that specify the types of files that may be selected. The strings “audio/*”, “video/*”, and “image/*” are also legal. Mirrors the accept attribute.

string autocomplete

True if the browser can prefill this Input element with a value from a previous session. Mirrors that autocomplete attribute. See also the autocomplete property of Form.

boolean checked

For checkable input elements, this property specifies whether the element is “checked” or not. Setting this property changes ...

Get JavaScript: The Definitive Guide, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.