THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

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

Property
length Yes Yes Yes Yes Yes

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