Line 18: Line 18:
 
<label for="pet-select">Choose a pet:</label>
 
<label for="pet-select">Choose a pet:</label>
 
<select name="pets" id="pet-select">
 
<select name="pets" id="pet-select">
     <input type="option" value="">--Please choose an option--</input>
+
     <option value="">--Please choose an option--</option>
     <input type="option" value="dog">Dog</input>
+
     <option value="dog">Dog</option>
     <input type="option" value="cat">Cat</input>
+
     <option value="cat">Cat</option>
     <input type="option" value="hamster">Hamster</input>
+
     <option value="hamster">Hamster</option>
     <input type="option" value="parrot">Parrot</input>
+
     <option value="parrot">Parrot</option>
     <input type="option" value="spider">Spider</input>
+
     <option value="spider">Spider</option>
     <input type="option" value="goldfish">Goldfish</input>
+
     <option value="goldfish">Goldfish</option>
 
</select>
 
</select>
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 31: Line 31:
 
<label for="pet-select">Choose a pet:</label>
 
<label for="pet-select">Choose a pet:</label>
 
<select name="pets" id="pet-select">
 
<select name="pets" id="pet-select">
     <input type="option" value="">--Please choose an option--</input>
+
     <option value="">--Please choose an option--</option>
     <input type="option" value="dog">Dog</input>
+
     <option value="dog">Dog</option>
     <input type="option" value="cat">Cat</input>
+
     <option value="cat">Cat</option>
     <input type="option" value="hamster">Hamster</input>
+
     <option value="hamster">Hamster</option>
     <input type="option" value="parrot">Parrot</input>
+
     <option value="parrot">Parrot</option>
     <input type="option" value="spider">Spider</input>
+
     <option value="spider">Spider</option>
     <input type="option" value="goldfish">Goldfish</input>
+
     <option value="goldfish">Goldfish</option>
 
</select>
 
</select>
  

Revision as of 15:43, 4 January 2023

Name

option

Type

input

Synopsis

How to render an option input field. Mostly used within the input select fields.

Description

The Missing value attribute.

   
   
   
   
   
   

</select> </syntaxhighlight>


or use the compliant HTML version :

<label for="pet-select">Choose a pet:</label>
<select name="pets" id="pet-select">
    <option value="">--Please choose an option--</option>
    <option value="dog">Dog</option>
    <option value="cat">Cat</option>
    <option value="hamster">Hamster</option>
    <option value="parrot">Parrot</option>
    <option value="spider">Spider</option>
    <option value="goldfish">Goldfish</option>
</select>


Note

See also input/select from the menu on the right

Links

See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option for all the details.