HTML <option> selected Attribute

The selected attribute on an <option> tag specifies that the dropdown option is selected, i.e. highlighted.

Example

#

A selected attribute on an <option> element.
Of the countries, Sweden is selected.

<select>
  <option label="">-- Select a Country --</option>
  <option value="denmark">Denmark</option>
  <option value="sweden" selected>Sweden</option>
  <option value="norway">Norway</option>
</select>

Using selected

The selected attribute specifies a selected (highlighted) option in a dropdown control.

When the page loads, this will be the selected item.

In a standard, single-select dropdown control, only one option can have a selected attribute.

With multiple options selected, only the last option with this attribute will be selected.

However, a multi-select dropdown control, with the multiple attribute, can have multiple options selected.


Syntax

<option selected>

Browser support

Here is when selected support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
8.0 Mar 2009
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <option>
Guides