Horje
How to Visible HTML Select Option Values

Use the size attribute to specify the number of visible values:


Simple Example of Visible HTML Select Option Values

Example: HTML
 <label for="cars">Choose a car:</label>
<select id="cars" name="cars" size="3">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="fiat">Fiat</option>
  <option value="audi">Audi</option>
</select> 

Full Example of Visible HTML Select Option Values

Visible Option Values Use the size attribute to specify the number of visible values.
index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<h2>Visible Option Values</h2>

<p>Use the size attribute to specify the number of visible values.</p>

<form action="/action_page.php">
  <label for="cars">Choose a car:</label>
  <select id="cars" name="cars" size="3">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="fiat">Fiat</option>
    <option value="audi">Audi</option>
  </select><br><br>
  <input type="submit">
</form>

</body>
</html>

Output should be:

Full Example of Visible HTML Select Option Values





Category:
Web Tutorial
Sub Category:
HTML Form Elements
Uploaded by:
Admin


Read Article
https://develop.horje.com/learn/1434/reference