HTMLOptionElement: defaultSelected property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
ThedefaultSelected property of theHTMLOptionElement interface specifies the default selected state of the element. This property reflects the<option> element'sselected attribute. The presence of theselected attribute sets thedefaultSelected property totrue.
In this article
Value
A boolean.
Examples
js
const optionElement = document.getElementById("water");console.log(optionElement.defaultSelected);Specifications
| Specification |
|---|
| HTML> # dom-option-defaultselected> |