HTML <option> selected Attribute

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

If used in a multi-select dropdown, only the last option will be selected.



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

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

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.


<option selected>

Browser support

Here is when selected support started for each browser:

1.0 Sep 2008
1.0 Sep 2002
8.0 Mar 2009
1.0 Jan 2006
1.0 Jan 2003

You may also like

 Back to <option>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023

What's your favorite/least favorite part of Dofactory?