HTMLFormElement: length property - Web APIs | MDN (original) (raw)
Baseline
Widely available
The **HTMLFormElement.length
**read-only property returns the number of controls in the element.
You can access the list of the form's controls using theelements property.
This includes both elements that are descendants of the <form>
element as well as elements that are made members of the form using theirform
property.
Elements that are considered for this property are: ,, (with the exception that any whose type is "image" are omitted for historical reasons),, , , and .
Value
A number.
Examples
if (document.getElementById("form1").length > 1) {
// more than one form control here
}
Specifications
Specification |
---|
HTML # dom-form-length-dev |