HTML <option> selected Attribute

Definition and Usage

selected The attribute is a boolean attribute.

When it exists, it specifies that an 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