Tag: <select>

<select> Syntax

Syntax Diagram for <select>
Opening Tag Content Closing
Open Parameter = Value Close
<select name = "name" > option
size = lines

Syntax Diagram for <option>
Opening Tag Content
Open Parameter = Value Close
<option value = "value" > option

<select> Description

The <select> input element of a <form> is a one-of-many (if multiple was not specified) or n-of-many (if multiple was specified) selection mechanism.
Specifies the name of the field, so the handling script can associate the field name and its value.
Specifies the height, expressed in lines of text, of the selection list. This is not a logical size, but just an apparent size--entries will automatically scroll on and off the top and bottom of the list as the scroll bar is moved. Default is 1. If size=1, the list is presented as a pop-up menu; if size>1, the list is presented as a vertical list with a scroll bar.
Specifies whether or not the scrolling list allows multiple items to be selected simultaneously.
Allows an alternate value to be passed to the processing script (see the "President" example below). If a value is not specified, the value passed to the processing script is option.
Specifies that the given option is to be preselected, to give the user a default value for the selection.
See also the <form> tag, as well as <input> and <textarea>.

<select> Examples

This markup: <form method="POST" action=""> Favorite Color: <select name="Color"> <option>Red <option>Orange <option>Yellow <option>Green <option selected>Blue <option>Indigo <option>Violet </select><br> Choose a President: <select name="President" size=3> <option value="Washington">George Washington <option value="Adams">John Adams <option value="Jefferson" selected>Thomas Jefferson <option value="Madison">James Madison <option value="Monroe">James Monroe <option value="Adams">John Quincy Adams </select><br> Select the noble gases: <select name="Gases" size=5 multiple> <option>Hydrogen <option>Helium <option>Nitrogen <option>Oxygen <option>Fluorine <option selected>Neon <option>Chlorine <option selected>Argon <option>Krypton <option>Xenon <option>Radon </select><br> <input value=" Reset Fields " type=reset> <input type=submit name=SubmitBtn value=" Submit Form "> </form> . . .causes these results:
Favorite Color:
Choose a President:
Select the noble gases:

Last Modified: