Select size-eigenschap
Definitie en gebruik
size
Eigenschap instellen of teruggeven van de keuzelijst Size-eigenschap De waarde.
De size-eigenschap bepaalt het aantal zichtbare opties in de keuzelijst.
Opmerking:In Chrome en Safari kan de size-eigenschap mogelijk niet correct werken voor size="2" en size="3".
Zie ook:
HTML Referentiemanual:HTML <select> size property
HTML Referentiemanual:HTML <select> tag
Voorbeeld
Voorbeeld 1
Wijzig het aantal zichtbare opties in de keuzelijst:
document.getElementById("mySelect").size = "4";
Voorbeeld 2
Geef het aantal zichtbare opties in de keuzelijst terug:
var x = document.getElementById("mySelect").size;
Syntaxis
Geef de size-eigenschap terug:
selectObject.size
Stel de size-eigenschap in:
selectObject.size = number
Attribute value
Value | Description |
---|---|
number |
Specify the number of visible options in the dropdown list. If the value is greater than 1 but less than the total number of options in the list, the browser will add a scrollbar to indicate that there are more options to view. |
Technical details
Return value: | Number, representing the number of visible options in the dropdown list. |
---|
Browser support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |