<select name="Food"> <option value ="apples">Apples</option> <option value ="bananas">Bananas</option> <option value ="oranges" selected>Oranges</option> </select>
The above example demonstrates usage of the
selected attribute when using the
<option> element. In this example, the Oranges option has been selected.
selected attribute is used to select a given
<option> element as the default. This option will be selected upon the inital page load.
selected attribute is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either