HTML <button> disabledAttribute

HTML button 标签参考手册HTML <button> Tag

Example

Disable a button:

<button type="button" disabled>Click me!</button>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.


Definition and Usage

The disabled attribute is a boolean attribute.

If this attribute is present, the button is disabled.

A disabled button is unusable and unclickable.

You can set the disabled attribute so that users can click the button only when certain conditions are met (for example, when a checkbox is selected, etc.). Then, JavaScript can be used to remove the disabled attribute, making the button usable again.


Differences between HTML 4.01 and HTML5

NONE.


Differences between HTML and XHTML

In XHTML, attribute minimization is not allowed; the disabled attribute must be defined as <button disabled="disabled">.


Syntax

<button disabled>


HTML button 标签参考手册HTML <button> Tag Other Extensions