HTMLSelectElement: size プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
size
は HTMLSelectElement
インターフェイスのプロパティで、一度に表示されるべきオプションの数、つまり行数を指定します。これは、この <select>
要素の size
属性を反映します。省略された場合、値は 0
です。
メモ:
既定では、<select>
は multiple
が true の場合は 4 つの行が表示されます。それ以外の場合は単一の行を表示します。size
プロパティの既定値は 0
です。
値
数値です。
例
js
const selectElement = document.getElementById("fruits");
console.log(selectElement.size);
仕様書
Specification |
---|
HTML # dom-select-size |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
size |
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.