Select length Property
Example
Return the number of <option> elements found in a drop-down list:
var x = document.getElementById("mySelect").length;
The result of x will be:
4
Try it yourself »
Definition and Usage
The length property returns the number of <option> elements in a drop-down list.
Browser Support
The length property is supported in all major browsers.
Syntax
selectObject.length
Technical Details
Return Value: | A Number, representing the number of <option> elements found in the drop-down list |
---|
Select Object