HTML <option> (Option in Selection List) Tag

❮ Previous Reference Next ❯


<label for="lang">Choose a language:</label>

<select id="lang">
	<option value="HTML">HTML</option>
	<option value="CSS">CSS</option>
	<option value="JavaScript">JavaScript</option>


The <option> element specifies an item in a selection list defined by a select element.

This element should occur only within the context of a <select> and <datalist> element.

Note: Under HTML specifications, the closing tag for <option> is optional. However, for XHTML compatibility, the closing tag </option> is required.

Version: HTML 2, 3.2. 4, 4.01, 5

Standard Syntax

<option value="text">text</option>

Browser Support



Attribute Value Description
disabled disabled It's a Boolean attribute it specifies that an option should be disabled.
label text Specifies a textContent label for an option
selected selected Specifies that an option should be pre-selected when the page is loaded.
value text Defines a value for an option. And the value to be sent to a server.

Global Attributes

<option> element also supports the Global Attributes in HTML.

Event Attributes

<option> element also supports the Event Attributes in HTML.

More Examples

Use of <option> in a <datalist> element:


<label for="browser">Select the browser:</label>
<input list="browsers" name="browser" id="browser">
<datalist id="browsers">
	<option value="Edge">
	<option value="Firefox">
	<option value="Chrome">
	<option value="Opera">
	<option value="Safari">
	<option value="Samsung">

Use of <option> in <optgroup> elements:


  <optgroup label="Group 1">
    <option>Option 1.1</option>
  <optgroup label="Group 2">
    <option>Option 2.1</option>
    <option>Option 2.2</option>
  <optgroup label="Group 3" disabled>
    <option>Option 3.1</option>
    <option>Option 3.2</option>
    <option>Option 3.3</option>

By Default CSS Value(s)


Related Tags:

<button>, <datalist>, <fieldset>, <form>, <input>, <label>, <legend>, <meter>, <optgroup>, <output>, <progress>, <select> and <textarea>
❮ Previous Reference Next ❯