Gets the index of the selected option.
Setting the selectedIndex
property sets the option at
that index to be the selected option. To set one of the options to be
selected, set the selectedIndex
property to an index between 0
and
options.length - 1
.
To reset the dropdown to have no option
selected, set the selectedIndex
property to undefined
.
Getting the selectedIndex
property returns the index of
the currently selected option. If no value is selected, the
selectedIndex
property returns undefined
.