• Post category:HTML

How to Disable a Button in HTML | New Tricks

How to Disable a Button in HTML

In this article, we will see how to disable a button in HTML. We can create button using <button> or <input> tag. In both methods, using the “disabled” attribute will disable the button.

After we create a form and users fill the form completely, we should remove disable a button

How to make disable button

<!DOCTYPE html>
<html>
<head>
<title>disable button</title>
</head>
<body>

<button disabled>Submit</button>
<input disabled type="button" value="Submit">

</body>
</html>

Output:

how to disable a button in html

Steps:

  1. In the above code, we have written the general HTML syntax and the title is set to “disabled button”.
  2. In the body section, we have created two buttons using the button and input tag.
  3. See the above code, We have used the “disabled” attribute for both tags.
  4. See the above given output, both buttons have disabled.

Leave a Reply