Latest web development tutorials

HTML DOM Button disabled property

Button Object Reference Button Objects

Examples

Example 1

Disable a button:

<script>

document.getElementById("firstbtn").disabled=true;

</script>

Output:


try it"


Definition and Usage

disabled property sets or returns whether to disable the button.

Disabled elements are not available, can not be clicked. Disable display element is usually gray in your browser.

grammar

Set the disabled attribute:

button .disabled=true|false

Returns disabled properties:

button .disabled


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support disabled property


Button Object Reference Button Objects