HTML selected Attribute

❮ HTML Attributes


<label for="lang">Choose a language:</label>

<select id="lang">
  <option value="HTML">HTML</option>
  <option value="CSS" selected>CSS</option>
  <option value="JavaScript">JavaScript</option>


The selected attribute specifies that the associated item is the default selection.

If this attribute is not included, the first item in the selection list is the default.

Note: It should occur in only one entry. Under XHTML, the value of the selected attribute must be set to selected(selected="selected").

Standard Syntax

HTML: <element selected>
XHTML: <element selected="selected">

Browser Support


Applies to:

The selected attribute can be used on the following element:

Element Attribute
<option> selected

Attribute Values

Value Description
selected It's optional but mandatory in XHTML.
❮ HTML Attributes