'option' creates a list item in a 'select' element : option « Form « HTML / CSS






'option' creates a list item in a 'select' element

 
    
<html>
<head>
<title>option element example</title>
</head>
<body>
    <form name="form1" method="post" action="youractionscript.asp">
    <p>
        <span class="example">
            <select name="select1">
                <optgroup label="First Group">
                    <option>First item in first group</option>
                    <option>Second item in first group </option>
                    <option>Third item in first group </option>
                </optgroup>
                <optgroup label="Second Group">
                    <option>First item in second group </option>
                    <option>Second item in second group </option>
                    <option>Third item in second group </option>
                </optgroup>
                <optgroup label="Group 3">
                    <option>First item in Group 3</option>
                    <option>Second item in Group 3</option>
                    <option>Third item in Group 3</option>
                </optgroup>
            </select>
        </span>
    </p>
    </form>
</body>
</html>
    
      
        
  








Related examples in the same category

1.option color: white; background-color: blue;
2.Option groups
3.The option element
4.Creating groups of options with a disabled option