A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/en-US/docs/Web/API/HTMLFieldSetElement/elements below:

HTMLFieldSetElement: elements property - Web APIs

HTMLFieldSetElement: elements property

Baseline Widely available

The elements read-only property of the HTMLFieldSetElement interface returns an HTMLCollection object containing all form control elements (<button>, <fieldset>, <input>, <object>, <output>, <select>, and <textarea>) that are descendants of this field set.

You can access a particular form control in the returned collection by using either an index or the element's name or id attributes. If multiple form controls share the same name, as is common with a group of radio buttons, using the shared name returns the first element with that value.

Value

An HTMLCollection.

Examples
<form id="my-form">
  <fieldset id="my-fieldset">
    <legend>My fieldset</legend>
    <p>
      <label for="username">Username:</label>
      <input type="text" id="username" name="username" />
    </p>
    <p>
      <label for="password">Password:</label>
      <input type="password" id="password" name="password" />
    </p>
    <p>
      <input type="checkbox" id="remember-me" name="remember-me" />
      <label for="remember-me">Remember me</label>
    </p>
  </fieldset>
</form>
const fieldset = document.getElementById("my-fieldset");
console.log(fieldset.elements.length); // 3
console.log(fieldset.elements["remember-me"].value); // "on"
Specifications Browser compatibility See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4