Name

selected — NN 2 IE 3 DOM 1

Synopsis

Read/Write

Whether the list option has been selected by the user, meaning that its value is submitted with the form. Scripts can modify the value to select an item algorithmically. To find out which option is selected, it is more efficient to use the select object’s selectedIndex property, rather than looping through all options in search of those whose selected properties are true. The exception to this is when the SELECT element is set to allow multiple selections, in which case you need to cycle through them all to find the chosen items.

Example

document.forms[0].selectList.options[3].selected = true

Value

Boolean value: true | false.

Default

false

Get Dynamic HTML: The Definitive Reference 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.