X
HOME HTML5 CSS3 JAVASCRIPT SQL PHP5 JQUERY ANGULAR BOOTSTRAP3 XML MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

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

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook