Last Updated on April 26, 2023 by Roshan Parihar
HTML option tag is used in select tag to show select options.
Syntax
1 |
<option>Enter option here</option> |
1 2 3 4 5 6 7 8 9 |
<label for="country">Select your Batsman</label> <select name="country"> <option value="India">Sachin Tendulkar</option> <option value="Australia">Ricky Ponting</option> <option value="England">Kevin Peterson</option> <option value="Kenya">Mauriss Odumbe</option> <option value="West Indies">Brian Lara</option> <option value="Sri Lanka">Sanath Jayasurya</option> </select> |
Output
List of HTML option tag attributes
Sr. No. | attribute options | Description |
---|---|---|
1 | label | This attribute is used to specify the label of options. The value of this can be any text. |
2 | disabled | This attribute used to indicate that the option is not selectable. The value for this is disabled. |
3 | selected | This attribute used to indicate that the option is selected or not. The value for this is selected. |
4 | value | This attribute used to specify the value of options. It can be any value you want for specified option. |
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github