Page 80 - Code_GPT_Class_8
P. 80
THE <SELECT> TAG
The <SELECT> tag is used to add a drop-down list in the HTML form. This tag produces a list of options for
the user with the help of <OPTION> tag. We can create a combo box using <SELECT> and <OPTION> tags.
Adding Combo Box
Sometimes, it is necessary to display multiple options in the form of a drop-down menu or list from
which the user can select only one option at a time. This type of control is known as combo box. The
<SELECT> tag with the <OPTION> tag allows us to create a drop-down list.
The <OPTION> tag specifies an option in the drop-down list. To create a combo box in a form, use the
following syntax:
<SELECT>
<OPTION> Option 1
<OPTION> Option 2
<OPTION> Option N
</SELECT>
For example:
<SELECT NAME="City">
<OPTION>Aligarh
<OPTION>Ghaziabad
<OPTION>Meerut
</SELECT>
The above code will create a dropdown list in which three options are available.
Let us create a web page to display the combo box.
<!DOCTYPE html>
<HTML>
<BODY>
<FORM>
Select Stream:
<SELECT NAME="List Name">
<OPTION>Science
<OPTION>Commerce
<OPTION>Arts
</SELECT>
</FORM>
</BODY>
</HTML>
CodeGPT (Ver. 4.0)-VIII
78

