DOM HTMLFormElement.elements Property
The elements property returns all the controls in a form, which can be looked up by name or index.
Description
The read-only elements property returns a live collection of all the form controls in the form (inputs, selects, textareas, buttons, fieldsets and outputs), including those associated with it through the form attribute. Controls can be accessed by index or by their name or id: form.elements.email.value. A group of radio buttons sharing a name returns a RadioNodeList whose value is the checked one.
Image inputs (type="image") aren't included, for historical reasons. The collection is live, so controls added to the form with JavaScript appear in it automatically.
To get all the form's data in one step, new FormData(form) is usually easier than reading each control, since it handles checkboxes, radio groups, multiple selections and file inputs correctly, and skips disabled controls just like a real submission.
Syntax
form.elementsValue
An HTMLFormControlsCollection of the form's controls, accessible by index, name or id.
Example
Browser Support
The following information will show you the current browser support for the HTMLFormElement.elements property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





