<select> tag in HTML
The <select> tag is used to create an drop down list box, that allows users to pick one among a number of given options.
The options in a <select> list are provided using th<option> tag.
attributes in <select> tag
<select> tag has attributes, we are going to see some of the important ones.
- multiple
- size
multiple attribute in <select> tag
It allows user to select more than one options from the list.
size attribute in <select> tag
It is used to display specified number of items.
<option> tag in HTML
The <option> tag represents an option in a <select> tag or in a <datalist> tag.
The behavior of this element varies slightly according to, in which of these two tags it's used on.
selected attribute in <option> tag
selected attribute is used to set an option as a default value in the dropdown list box.
In the above example Mango is selected in first load.
disabled attribute in <option> tag
This attribute is used to disable the specified list in the dropdown list box.
In the above example, you can not able to select the Mango list.
value attribute in <option> tag
This attribute is used to assign a value to each and every list items.
This attribute is accessed from javascript code.