Name
selectedIndex — NN 2 IE 3 DOM 1
Synopsis
Read/Write
The zero-based integer of the option selected by the user. If the
SELECT
element is set to allow multiple
selections, the selectedIndex
property returns the
index of the first selected item (see the selected
property). You can use this property to gain access to the value or
text of the selected item, as shown in the example.
Example
var list = document.forms[0].selectList var listValue = list.options[list.selectedIndex].value
Value
Positive integer.
Default
None.
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.