Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 77423 of HTMLOptionsCollection

  • Revision slug: DOM/HTMLOptionsCollection
  • Revision title: HTMLOptionsCollection
  • Revision id: 77423
  • Created:
  • Creator: mkato
  • Is current revision? No
  • Comment 3 words added, 1 words removed

Revision Content

HTMLOptionsCollection is an interface representing a collection of HTML option elements (in document order) and offers methods and properties for traversing the list as well as optionally altering its items. This type is returned solely by the "options" property of select.

Properties

Name Type Description
length   As optionally allowed by the spec, Mozilla allows this property to be set, either removing options at the end when using a shorter length, or adding blank options at the end when setting a longer length. Other implementations could potentially throw a DOMException.

Methods

  • item(index) - returns the specific node at the given zero-based index (gives null if out of range)
  • namedItem(name) - returns the specific node with the given DOMString (i.e., string) id. Returns null if no such named node exists.

Specification

 See also

Revision Source

<p>HTMLOptionsCollection is an interface representing a collection of HTML option elements (in document order) and offers methods and properties for traversing the list as well as optionally altering its items. This type is returned solely by the "options" property of <a href="/en/DOM/HTMLSelectElement" title="En/DOM/select">select</a>.</p>
<h3>Properties</h3>
<table class="standard-table"> <tbody> <tr> <td class="header">Name</td> <td class="header">Type</td> <td class="header">Description</td> </tr> <tr> <td><code>length</code></td> <td> </td> <td>As optionally allowed by the spec, Mozilla allows this property to be set, either removing options at the end when using a shorter length, or adding blank options at the end when setting a longer length. Other implementations could potentially throw a <a href="/En/DOM/DOMException" title="En/DOM/DOMException">DOMException</a>.</td> </tr> </tbody>
</table>

<h3>Methods</h3>
<ul> <li>item(index) - returns the specific node at the given zero-based index (gives null if out of range)</li> <li>namedItem(name) - returns the specific node with the given DOMString (i.e., string) id. Returns null if no such named node exists.</li>
</ul>
<h3>Specification</h3>
<ul> <li><a class=" external" href="https://www.w3.org/TR/DOM-Level-2-HTML/html.html#HTMLOptionsCollection" rel="freelink">https://www.w3.org/TR/DOM-Level-2-HTM...ionsCollection</a></li>
</ul>
<h3> See also</h3>
<ul> <li><a href="/en/DOM/HTMLCollection" title="En/DOM/HTMLCollection">HTMLCollection</a></li>
</ul>
Revert to this revision