Latest web development tutorials

HTML button disabled property

HTML button labels Reference Manual HTML <button> tag

Examples

Disable a button:

<button type="button" disabled>点我!</button>

try it"

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute


Definition and Usage

disabled property is a boolean (Boolean) property.

If you use this attribute, the button is disabled.

Disabled buttons can not be used and can not be clicked.

It can be set on the disabled attribute so that the user when certain conditions are met (for example, check the box, etc.) in order to click the button. Then, you can use JavaScript to remove the disabled attribute so that the buttons become available in the state.


Differences between HTML 4.01 and HTML5

NONE.


Differences between HTML and XHTML

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


grammar

<button disabled>


HTML button labels Reference Manual HTML <button> tag