English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML: <input> disabled attribute

The disabled attribute is a boolean attribute, the disabled input element cannot be used and cannot be clicked, if present, it specifies which <input> element should be disabled.

 HTML <input> tag

Online Example

HTML form with disabled input field:

!DOCTYPE html
<html>
<head>
<title>HTML: <input> disabled attribute - Basic Tutorial Website(oldtoolbag.com)</title>
<body>
<form action="action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname" disabled><br>
  <input type="submit" value="Submit">
</form>
</html>
Test to see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the disabled attribute.

Definition and Usage

The disabled attribute is a boolean attribute.

If present, it specifies the <input> element that should be disabled.

Disabled input elements are not usable and cannot be clicked.

You can set the disabled attribute to prevent users from using the <input> element until certain other conditions are met (such as checking a checkbox, etc.). Then, JavaScript can remove the disabled value and make the <input> element available.
Tip: Disabled <input> elements in forms will not be submitted!

Note:The disabled attribute does not apply to <input type="hidden">.

HTML 4.01 With HTML5Differences

None.

Differences between HTML and XHTML

In XHTML, attribute shorthand is prohibited, the disabled attribute must be defined as <input disabled="disabled" />.

Syntax

<input disabled>
 HTML <input> tag