Name

HTMLSelectElement — a <select> element in an HTML form

Availability

DOM Level 1 HTML

Inherits from/Overrides

Node Element HTMLElement HTMLSelectElement

Properties

boolean disabled

If true, the <select> element is disabled and the user may not interact with it. Mirrors the disabled attribute.

readonly HTMLFormElement form

The <form> element that contains this one.

readonly long length

The number of <option> elements contained by this <select> element. Same as options.length.

boolean multiple

If true, the <select> element allows multiple options to be selected. Otherwise, the selections are mutually exclusive and only one may be selected at a time. Mirrors the multiple attribute.

String name

The name of this form element. Mirrors the name attribute.

readonly HTMLCollection options

An array (HTMLCollection) of HTMLOptionElement objects that represent the <option> elements contained in this <select> element, in the order in which they appear.

long selectedIndex

The position of the selected option in the options array. If no options are selected, this property is -1. If multiple options are selected, this property returns the index of the first selected option.

long size

The number of options to display at once. If this property is 1, the <select> element will typically be displayed using a drop-down menu or list. If it is greater than 1, the <select> is typically displayed using a fixed-size list control, with a scrollbar if necessary. Mirrors the size attribute. ...

Get JavaScript: The Definitive Guide, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.