YouTip LogoYouTip

Prop Select Disabled

HTML DOM Select disabled Property .lookup { width: 340px; margin: 0 auto; } form { background: #f5f5f5; padding: 20px; }

HTML DOM Select disabled Property

Select object

Definition and Usage

The disabled property sets or returns whether a dropdown list should be disabled.

A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by browsers.

This property reflects the HTML disabled attribute.


Syntax

Return the disabled property:

selectObject.disabled

Set the disabled property:

selectObject.disabled = true|false

Property Values

Value Description
true|false Specifies whether a dropdown list should be disabled.
  • true - The dropdown list is disabled
  • false - Default. The dropdown list is not disabled

Return Value

Type Description
Boolean Returns true if the dropdown list is disabled, otherwise returns false.

Example

Disable the dropdown list:

Example

In this example, we disable the dropdown list:

<select id="mySelect">
  <option>Apple</option>
  <option>Orange</option>
  <option>Pineapple</option>
  <option>Banana</option>
</select>

<script>
document.getElementById("mySelect").disabled = true;
</script>

Try it Β»



Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property Google Chrome
Chrome
Microsoft Edge
Edge
Firefox
Firefox
Safari
Safari
Opera
Opera
Yes
Yes
Yes
Yes
Yes

Try it Yourself - Examples

Toggle between disabled and enabled states of a dropdown list.

Try it Yourself Β»

Find out if a dropdown list is disabled or not.

Try it Yourself Β»

← Prop Select FormColl Select Options β†’