Get to know MDN better
The length property of the HTMLOptionsCollection interface returns the number of <option> elements in the collection. The property can get or set the size of the collection.
When setting length to a value smaller than the current, the options collection gets truncated; otherwise, new blank <option> elements are appended to the end of the <select>.
An integer value representing the number of items in this HTMLOptionsCollection.
| HTML # dom-htmloptionscollection-length-dev |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Sep 28, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.