Set selected element in a drop down list
Question:
How to set selected element in a drop down list? Answer:
<!-- Use the selected attribute to select an element / option -->
<select name="range">
<option value="1">1..9</option>
<option value="2" selected>10..19</option>
<option value="3">20..29</option>
</select>
Description:
Include a selected
attribute on an <option>
element to make it selected by default when the page first loads.
Reference:
The select element reference
Share "How to set selected element in a drop down list?"
Related snippets:
Tags:
select, drop down, option, html, element Technical term:
Set selected element in a drop down list