avatar

Hassan khan

Last updated: December 22,2022

How to disable buttin in html?

Disable html button


There is an attribute called disabled which disables your button.
Once the button is disabled then it will not be clicked.
This attribute may change with javascript. We can programmatically change the value of this attribute with javascript.


Here is snippet:

1
<button type="button" disabled> Click Me! </button>

With this attribute, we can disable input elements of HTML like text fields, checkboxes, date fields, etc.


Share