FormControl — common features of all form controls


Most HTML form controls are <input> elements, but forms can also contain <button>, <select>, and <textarea> controls. This page documents the features that those element types have in common. See HTML Forms for an introduction to HTML forms, and see Form, Input , Select, and TextArea for more on forms and form controls.

The <fieldset> and <output> elements implement most, but not all, of the properties described here. This reference treats FieldSet and Output objects as FormControls even though they do not implement every property.

This page documents certain HTML5 form features (particularly form validation) which, at the time of this writing, were not yet widely implemented.


boolean autofocus

true if the control should automatically receive keyboard focus as soon as the document is loaded. (FieldSet and Output controls do not implement this property.)

boolean disabled

true if the form control is disabled. Disabled controls do not respond to user input and are not subject to form validation. (Output elements do not implement this property; FieldSet elements use it to disable all of the controls they contain.)

readonly Form form

A reference to the Form that is the owner of this control, or null if it does not have one. If a control is contained within a <form> element, that is its form owner. Otherwise, if the control has an HTML form attribute that specifies the ID of a <form>, that named form is the form owner. ...

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.