| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/option | [Back] [Original] |
Get to know MDN better
<option> HTML option elementThis feature is well established and works across many devices and browser versions. Its been available across browsers since July 2015.
The <option> HTML element is used to define an item contained in a <select>, an <optgroup>, or a <datalist> element. As such, <option> can represent menu items in popups and other lists of items in an HTML document.
<label for="pet-select">Choose a pet:</label>
<select id="pet-select">
<option value="">--Please choose an option--</option>
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
<option value="parrot">Parrot</option>
<option value="spider">Spider</option>
<option value="goldfish">Goldfish</option>
</select>
label {
font-family: sans-serif;
font-size: 1rem;
padding-right: 10px;
}
select {
font-size: 0.9rem;
padding: 2px 5px;
}
This element includes the global attributes.
disabledIf this Boolean attribute is set, this option is not checkable. Often browsers gray out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one of its ancestors is a disabled <optgroup> element.
labelThis attribute is text for the label indicating the meaning of the option. If the label attribute isn't defined, its value is that of the element text content.
selectedIf present, this Boolean attribute indicates that the option is initially selected. If the <option> element is the descendant of a <select> element whose multiple attribute is not set, only one single <option> of this <select> element may have the selected attribute.
valueThe content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element.
Styling <option> elements has historically been highly limited. Customizable select elements explains newer features that enable their full customization, just like any regular DOM element.
In browsers that don't support the modern customization features (or legacy codebases where they can't be used), the styling available on <option> elements depends on the browser and operating system. Depending on the operating system, the font-size of the owning <select> is respected in Firefox and Chromium. Chromium may additionally allow color, background-color, font-family, font-variant, and text-align to be set.
You can find more details about legacy <option> styling in our guide to advanced form styling.
See <select> for examples.
| Content categories | None. |
|---|---|
| Permitted content |
In traditional <select> elements, only text content is permitted, possibly with escaped characters (like
é). In customizable select elements, <option> elements can have any arbitrary content.
|
| Tag omission |
The start tag is mandatory. The end tag is optional if this element is
immediately followed by another <option> element or an
<optgroup>, or if the parent element has no
more content.
|
| Permitted parents |
A <select>, an
<optgroup> or a
<datalist> element.
|
| Implicit ARIA role | option |
| Permitted ARIA roles | No role permitted |
| DOM interface | HTMLOptionElement |
| Specification |
|---|
| HTML # the-option-element |
<form>, <legend>, <label>, <button>, <select>, <datalist>, <optgroup>, <fieldset>, <textarea>, <input>, <output>, <progress> and <meter>.This page was last modified on Aug 27, 2026 by MDN contributors.
<a><abbr><acronym><address><area><article><aside><audio><b><base><bdi><bdo><big><blockquote><body><br><button><canvas><caption><center><cite><code><col><colgroup><data><datalist><dd><del><details><dfn><dialog><dir><div><dl><dt><em><embed><fencedframe><fieldset><figcaption><figure><font><footer><form><frame><frameset><geolocation><h1><h6><head><header><hgroup><hr><html><i><iframe><img><input><ins><kbd><label><legend><li><link><main><map><mark><marquee><menu><meta><meter><nav><nobr><noembed><noframes><noscript><object><ol><optgroup><option><output><p><param><picture><plaintext><pre><progress><q><rb><rp><rt><rtc><ruby><s><samp><script><search><section><select><selectedcontent><slot><small><source><span><strike><strong><style><sub><summary><sup><table><tbody><td><template><textarea><tfoot><th><thead><time><title><tr><track><tt><u><ul><var><video><wbr><xmp>accesskeyanchorautocapitalizeautocorrectautofocusclasscontainertimingcontainertimingignorecontenteditabledata-*dirdraggableenterkeyhintexportpartsheadingoffsetheadingresethiddenidinertinputmodeisitemiditempropitemrefitemscopeitemtypelangnoncepartpopoverslotspellcheckstyletabindextitletranslatevirtualkeyboardpolicywritingsuggestions<input type><input type="button"><input type="checkbox"><input type="color"><input type="date"><input type="datetime-local"><input type="email"><input type="file"><input type="hidden"><input type="image"><input type="month"><input type="number"><input type="password"><input type="radio"><input type="range"><input type="reset"><input type="search"><input type="submit"><input type="tel"><input type="text"><input type="time"><input type="url"><input type="week"><script type>Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |