Using Option Selected To Define A Default Selection In Drop-Down List
Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
- Attribute of
- <option> HTML Tag
- What does
Using Option Selected To Define A Default Selection In Drop-Down List
do? - Defines the default selection in a drop-down list.
Code Example
<p><strong>Select your favorite species of flamingo.</strong></p>
<select name="favorites">
<option value="American">American flamingo</option>
<option value="Greater">Greater flamingo</option>
<option value="Lesser">Lesser flamingo</option>
<option selected value="Andean">Andean flamingo</option>
<option value="Chilean">Chilean flamingo</option>
<option value="James's">James's flamingo</option>
</select>
Select your favorite species of flamingo.
Convenient Form Entry
The selected
attribute allows you to set one of your <option>
lines as the default. This is a good technique to speed up data entry if the majority of visitors are likely to select the same option.
Browser Support for selected
All | All | All | All | All | All |