The HTML selected attribute
Quick answer
The HTML selected attribute pre-selects an option in a <select> by default. It is used on the <option> element.
Overview
Syntax
<option value="2" selected>Two</option>
Values
| Value |
|---|
| A boolean attribute: present or absent. |
Example
<select><option>One</option><option selected>Two</option></select>
Best practices
Frequently asked questions
What does the selected attribute do?
Pre-selects a dropdown option.
How do I group options in a drop-down?
What is selected if no option has the attribute?
Which elements use the selected attribute?
It is an element-specific attribute, used on the <option> element.