HTML <option> selected attribute

Definition and usage

selected The attribute is a boolean attribute.

When present, it specifies that a particular option should be pre-selected when the page is loaded.

The pre-selected option will be displayed first in the dropdown list.

Tip:It can also be set using JavaScript after the page is loaded selected Attributes.

Example

Dropdown list with pre-selected option:

<label for="cars">Please select a car brand:</label>
<select id="cars">
  <option value="audi">Audi</option>
  <option value="byd">BYD</option>
  <option value="geely">Geely</option>
  <option value="volvo" selected>Volvo</option>
</select>

Try it yourself

Syntax

<option selected>

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support