Select length attribute
Definition and Usage
length
Property returns the number of <option> elements in the dropdown list.
See also:
HTML Reference Manual:HTML <select> Tag
Example
The number of <option> elements found in the dropdown list:
var x = document.getElementById("mySelect").length;
Syntax
selectObject.length
Technical Details
Return Value: | A number representing the number of <option> elements found in the dropdown list. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |