Favorites

DOM HTMLFormElement.elements Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
HTMLFormElement.elements
DOM HTMLFormElement PropertyThis property is supported by all modern browsers.
Updated 28th November 2026

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.elements

Value

An HTMLFormControlsCollection of the form's controls, accessible by index, name or id.

Example

<form id="order">
  <input name="qty" value="2">
  <label><input type="radio" name="size" value="S"> S</label>
  <label><input type="radio" name="size" value="M" checked> M</label>
  <button>Order</button>
</form>
const form = document.getElementById('order');
console.log(form.elements.length);
console.log(form.elements.qty.value);
console.log(form.elements.size.value);
for (const el of form.elements) console.log(el.tagName, el.name);

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.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee