Search...
selectedIndex
Gets the index of the selected option.
Description
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
.
Type:
numberRead & Write
Was this helpful?
Get the selected index
Copy Code
1let selectedIndex = $w("#myThumbnails").selectedIndex; // 0
Set the selected index
Copy Code
1$w("#myThumbnails").selectedIndex = 0;