Display the index and text of the selected option in a drop-down list:
The index property sets or returns the index position of an option in a drop-down list.
The index starts at 0.
The index property is supported in all major browsers.
Return the index property:
Set the index property:
Value | Description |
---|---|
integer | Specifies the index position of the option within a drop-down list |
Return Value: | A Number, representing the index position of the option within a drop-down list. The index starts at 0. |
---|
Display the text and index of all options in a drop-down list: