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.

sizeHTMLSelectElement インターフェイスのプロパティで、一度に表示されるべきオプションの数、つまり行数を指定します。これは、この <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 GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
size

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

関連情報