Horje

How to add A drop-down list with a pre-selected option - HTML selected Attribute

The option selected attribute.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h1>The option selected attribute</h1>

<label for="cars">Choose a car:</label>

<select id="cars">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="vw">VW</option>
  <option value="audi" selected>Audi</option>
</select>

</body>
</html>

Output should be:

How to add A drop-down list with a pre-selected option - HTML selected Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Attribute
Uploaded by:
Admin