In this tutorial we will include list menus in our web page's form.
Now that we have learnt all of the input types and textareas from the previous tutorials we can now learn another major way for the end user to choose data in the form, and that is using the <select></select>, <optgroup></optgroup> and <option></option> tags. A list menu allows the user to select one item from a list of items.
<select></select> creates the list menu in the form
<optgroup></optgroup> groups certain options together for better layout
<option></option> creates the separate options to choose from
Attributes we will be using;
name the name of the list
label the name for an option group
multiple allows multiple options to be selected
size the number of options shown [default 1]
Here is an example of a list menu
<select name="theList" size="1">
The optgroup tag is optional. However looking at the drop down box you can see that the grouping and options are listed and you are able to select only one. If you used the multiple attribute you would be able to select a number of options by holding ctrl whilst selecting.