Name
HTMLFormControlsCollection — a array-like object of form controls
Inherits from
HTMLCollection
Synopsis
HTMLFormControlsCollection is a specialized HTMLCollection
used by Form elements to represent collections of form controls.
Like HTMLCollection, you can index it numerically, like an array, or
treat it like an object and index it with the names or IDs of form
controls. HTML forms often have multiple controls (usually radio
buttons or checkboxes) that have the same value for their name attribute, and an
HTMLFormControlsCollection handles this differently than an ordinary
HTMLCollection would.
When you read a property of an HTMLFormControlsCollection, and
the form contains more than one element that has that property as
its name, the HTMLFormControlsCollection returns an array-like
object of all form controls that share the name. In addition, the
returned array-like object has a value property that returns the value attribute of the first checked radio
button with that name. You can even set this value property to check the radio button
with the corresponding value.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access