This <option> element is used to create a list item in a <select>
element list.
<option> |
Yes | Yes | Yes | Yes | Yes |
None.
Attribute | Value | Description |
---|---|---|
disabled | disabled | disable an option |
label | text | Set a shorter label for an option |
selected | selected | pre-selected an option when the page loads |
value | text | Set the value to be sent to a server |
The <option> tag supports the Global Attributes in HTML.
The <option> tag supports the Event Attributes in HTML.
None.
A demo showing how to use <option> tag.
<html>
<body>
<form>
<select name="select1">
<optgroup label="First Group">
<option>First</option>
<option>second</option>
<option>third</option>
</optgroup>
</select>
</form>
</body><!--from w w w . j a v a 2 s. com-->
</html>