From MDN:
defaultSelected - Optional
A Boolean that sets the selected attribute value, i.e. so that this will be the default value selected in the element when the page is first loaded. If this is not specified, a default value of false is used. Note that a value of true does not set the option to selected if it is not already selected.selected - Optional
A Boolean that sets the option's selected state; the default is false (not selected). If omitted, even if the defaultSelected argument is true, the option is not selected.
This is very unclear to me. defaultSelected
determines if "this will be the default value selected", but one sentence later it says "a value of true does not set the option to selected if it is not already selected". So... it doesn't set it to be selected? It only sets it to selected if it's already selected?
selected
claims also to set the selected state. If it's omitted, regardless of defaultSelected
, the option is not selected. So... defaultSelected
does nothing?
What's going on here?