👀 Live Preview
Simple select with two options:

The <option> tag defines individual choices in dropdown menus. This guide covers syntax, key attributes, common form patterns, and how option works with select and optgroup.
One choice per option.
Child of select or optgroup.
Data sent on form submit.
Default pre-selected item.
Block unavailable choices.
Label select, clear options.
<option> Tag?The <option> tag is an essential HTML element used within the <select> element to define individual options in a dropdown menu. It allows users to choose from a list of predefined values when filling out a form.
Each <option> represents one item in the menu. The text between tags is what users see; the value attribute is what the server receives on submit.
Options can also appear inside <optgroup> for categorized menus, or inside <datalist> to suggest values for text inputs.
Place <option> inside <select>. Each option represents a single dropdown item:
<select>
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
<!-- Add more options as needed -->
</select>select, optgroup (inside select), or datalist.value for the submitted data; visible text is the element content.option should have selected in a single-select menu.<option> is valid when there is no inner text.| Topic | Code Snippet | Notes |
|---|---|---|
| Basic option | <option value="us">USA</option> | Visible + submitted |
| Default choice | selected | Pre-selected on load |
| Unavailable | disabled | Cannot be picked |
| Placeholder | value="" disabled selected | Prompt before choice |
| In optgroup | Inside optgroup | Grouped category |
| Browser support | Universal | All major browsers |
<option> vs <select>| Element | Role | Analogy |
|---|---|---|
<select> | Dropdown container | The menu box |
<option> | Individual choice | Each menu item |
<optgroup> | Labeled section | Category header |
The <option> tag supports attributes to customize appearance and behavior:
<select>
<option value="option1" selected>Default Option</option>
<option value="option2" disabled>Disabled Option</option>
</select>value SubmitValue sent to the server when the form is submitted.
value="option1"selected DefaultMarks the option pre-selected when the page loads.
selecteddisabled StateMakes the option unselectable in the dropdown.
disabledlabel DisplayAlternative visible label (used in optgroup context or when content is empty).
label="Display text"Build basic dropdowns and control default and disabled options in HTML forms.
Simple select with two options:
The <option> tag creates dropdown menus with selectable choices and supports selected and disabled for default and unavailable items.
The primary use of option is to create a dropdown menu with selectable choices.
<select>
<option value="option1">Option 1</option>
<option value="option2">Option 2</option>
</select>Use selected and disabled attributes to set the default choice and block unavailable options.
<select>
<option value="option1" selected>Default Option</option>
<option value="option2" disabled>Disabled Option</option>
</select><label for="id"> with the parent select, not individual options.value for server codes.disabled selected on a prompt option so users must pick actively.Define choices inside select with value attributes.
Browser lists all non-disabled options for selection.
Selected option’s value is sent with the form data.
Dropdowns collect consistent, validated choices from predefined options.
The <option> tag is supported in all major browsers including Internet Explorer.
Every browser renders <option> inside select menus with full attribute support.
Bottom line: Use <option> confidently in any browser for form dropdowns.
Mastering the <option> tag is essential for creating interactive and user-friendly dropdown menus in HTML forms. By leveraging its attributes and best practices, you can enhance the overall functionality of your web forms.
selectvalue for submitted form dataselect elementvalue when server needs specific codes<option>Bookmark these before you build form dropdowns.
One selectable dropdown choice.
BehaviorChild of select or optgroup.
StructureSubmitted form data.
AttributesDefault pre-selected item.
DefaultBlock unavailable choices.
StateAll major browsers.
Compatibilityvalue attribute on submit.select, optgroup, or datalist.<option value="" disabled selected>Choose...</option> as the first item.Practice <option> with selected and disabled in the Try It editor.
6 people found this page helpful