CSS Portal

HTML disabled Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
disabled
HTML AttributeThis attribute is supported by all modern browsers.
Updated 25th March 2024

Description

The HTML disabled attribute is a Boolean attribute used to indicate that an element is not available for interaction. When applied, it prevents the user from interacting with the element, including not being able to click on it, focus on it, or modify its value. This attribute can be used on various form elements such as <input>, <button>, <select>, <textarea>, and <optgroup>.

Elements with the disabled attribute set are typically rendered in a way that visually indicates they are not interactive. For example, a button or input field may appear dimmed or grayed out. Although these elements are visible on the page, users cannot interact with them to enter information or trigger actions.

Furthermore, when form elements are disabled, their values are not submitted with the form. This is an important consideration for developers to ensure that essential data is not excluded from submissions due to the use of the disabled attribute. To visually disable an element but still include its value in form submissions, alternatives such as the readonly attribute for input fields can be used.

In HTML, the disabled attribute is used without a value or with an empty string value (disabled or disabled="") and is considered true if present on the element, regardless of its value. The absence of the disabled attribute means the element is fully interactive.

Syntax

<tag disabled></tag>

Values

The disabled attribute is a boolean attribute, therefore no values are associated with this attribute.

Applies To

Example

<p>Buttons</p>
<button type="button">Button</button> <br><br>
<button type="button" disabled>Disabled button</button><br><br>
<p>Select Options</p>
<select>
<option value="css">CSS</option>
<option value="html">HTML</option>
<option value="javascript" disabled>Javascript</option>
</select><br><br>
<p>Checkboxes</p>
<label>
<input type="checkbox" name="chbox" value="regular" /> Regular
</label>
<label>
<input type="checkbox" name="chbox" value="disabled" disabled /> disabled
</label>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML disabled attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee