Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML DOM Select object


May 06, 2021 JavaScript with HTML DOM Reference book


Table of contents


HTML DOM Select object


Select object

The Select object represents a down-and-down list in an HTML form.

In HTML forms, every time a tag appears, a Select object is created.

You can access a Select object by traversing the form's array of elements, or you can use document.getElementById().


Select object collection

W3C: W3C standard.

gather describe W3C
options Returns an array containing all options in the drop-down list. Yes

Select object properties

Attributes describe W3C
disabled Set or return to whether the drop-down list should be disabled. Yes
form Returns a reference to a form that contains a drop-down list. Yes
length Returns the number of options in the drop-down list. Yes
multiple Set or return to whether multiple items are selected. Yes
name Set or return the name of the drop-down list. Yes
selectedIndex Set or return the index number of the selected item in the drop-down list. Yes
size Set or return to the number of visible lines in the drop-down list. Yes
type Returns the form type of the drop-down list. Yes

Select object method

method describe W3C
add() Add an option to the drop-down list. Yes
remove() Delete an option from the drop-down list. Yes

Standard properties and events

Select objects also support the standard properties and events.