Pr.Pg Next Pg

<Select> tag tutorials

  • The <select> element is used to create a drop-down list.

  • The <option> tags inside the <select> element define the available options in the list.

  • The <select> element is a form control and can be used in a form to collect user input.

  • The below table shows the attributes of the <Select> tag:

 

Sr No

Attributes

Descriptions

1

Disabled

Specifies that a drop-down list should be disabled

2

Multiple

Specifies that multiple options can be selected at once

3

Name

Defines a name for the drop-down list

4

form

This HTML5 attribute should be set to a string that corresponds to the id of the form element that the button is associated with. This allows form elements in one form to trigger actions in others.

5

Size

Defines the number of visible options in a drop-down list

 

Syntax:

<body>

<select>

<option>some text</option>

<option>some text</option>

</select>

</body>

 

Example: HTML program to demonstrate drop down using Select tag

Output:
Example: HTML program to demonstrate multiple size drop down list using Select tag.

Output: in FireFox:
Output: in Chrome:

Note: Size attribute does not work properly in Google chrome.

Example: HTML Program to demonstrate multi select drop down list using select tag

Output:

Note: To select multiple option press Ctrl + mouse click on the option which you want to select

Pr.Pg border                                              Next Pg