Select length Property

Select Object Reference Select Object

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

Internet Explorer Firefox Opera Google Chrome Safari

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 Reference Select Object

SHARE THIS PAGE

COLOR PICKER

colorpicker





Search w3schools.com:

Translate w3schools.com: