Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <option> disabled Attribute

The disabled attribute on an <option> tag disables the option.

It appears dimmed and is unselectable.

Example

#

A disabled attribute on 2 <option> tags.
The last 2 options cannot be selected.

<select>
  <option value="">-- Select City --</option>
  <option value="newyork">New York</option>
  <option value="losangeles">Los Angeles</option>
  <option value="chicago" disabled>Chicago</option>
  <option value="houston" disabled>Houston</option>
</select>

Using disabled

The disabled attribute specifies that the option is disabled.

The option appears grayed out and cannot be selected.


Syntax

<option disabled>
or
<option disabled="disabled">

Values

#

Value Description
disabled Use value 'disabled' or no value at all. Both are valid.

Browser support

Here is when disabled support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
8.0 Mar 2009
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <option>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides