Summary -
In this topic, we described about the <abbr> tag along with detailed example.
Selection form control option or datalist option. The <option> tag used to specified option items within a <select> or <datalist> list. <option> elements will be specified inside the <select> or <datalist> element.
The tag can be specified like <option value=""></option> with the option item coded in between the opening and closing tags. The option value for the value attribute can be used by javascripts.
The end tag can be ignored if the <option> or <optgroup> element is immediately followed by another <option> element. In all other cases, end tag is required.
Syntax -
<option>….</option>
Optional Attributes -
Attribute | Description | Values |
---|---|---|
disabled | Specifies the option should be disabled | Disabled |
label | Specifies the shorter label for an option. | Text. |
selected | Specifies the option pre-selected while page loads | Selected |
value | Specifies the value to be sent | Text. |
Example -
<!DOCTYPE html>
<html>
<head>
<title>Optgroup tag example.. </title>
</head>
<body>
Select from list:
<select>
<optgroup label="India">
<option value=" Andhra pradesh ">Andhra pradesh</option>
<option value=" Telangana">Telangana</option>
</optgroup>
<optgroup label="US">
<option value=" California">California</option>
<option value="new jersy">New jersy</option>
</optgroup>
</select>
</body>
</html>
Output -
Select from list -