JavaScript Answers

How to disable HTML button using JavaScript?

Spread the love

To disable HTML button using JavaScript, we set the button’s disabled property.

For instance, we write

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

to select the button with getElementById.

Then we disable the button by setting is disabled property to true.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *