HTMLOptionsCollection
HTMLOptionsCollection
インターフェイスは、 HTML の <option>
要素の集合を(文書内の順序で)表し、リストから選択すると共に、任意で項目を変更することもできるメソッドやプロパティを提供します。このオブジェクトが返されるのは、 select の options
プロパティからのみです。
インスタンスプロパティ
length
-
unsigned long
です。仕様上は、オプションで読み取り専用にしないことが認められています。値を下げることで末尾のオプションを削除したり、値を上げることで末尾に空白のオプションを追加したりすることができます。 Mozilla はこれを許可していますが、他の実装では DOMException が発生する可能性があります。
インスタンスメソッド
このインターフェイスは親である HTMLCollection
からメソッドを継承しています。
仕様書
Specification |
---|
HTML # the-htmloptionscollection-interface |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
HTMLOptionsCollection | ||||||||||||
add | ||||||||||||
length | ||||||||||||
remove | ||||||||||||
selectedIndex |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.