Change the selected option to "banana":
The value property sets or returns the value of the selected option in a drop-down list.
The value property is supported in all major browsers.
Return the value property:
Set the value property:
Value | Description |
---|---|
value | Specifies the value of an <option> element in a drop-down list that should get selected. If the value does not exist, the drop-down list will display an empty option |
Return Value: | A String, representing the value of the value attribute of an <option> element in the drop-down list. If the drop-down list allows multiple selections, the first selected option is returned. If there is no selected options, nothing is returned. |
---|
Return the value of a selected option in a drop-down list: