How to disable button element dynamically using JavaScript ?

The Button disabled property in HTML DOM is used to set or return whether a Button element would be disabled or not. A disabled element is un-clickable and unusable. It contains a boolean value.
Syntax: It is used to set the button disabled property.
buttonObject.disabled = "value"
Example: In this example, we will disable a button using the disabled attribute.
HTML
| <bodystyle="text-align:center">      <h1style="color: green;">         zambiatek     </h1>      <h2>         How to disable button element<br>         dynamically using JavaScript?     </h2>      <!-- Assigning id to Button. -->    <buttonid="GFG"onclick="Geeks()">         Submit     </button>      <br><br>      <pid="sudo"></p>      <script>         function Geeks() {                      document.getElementById("GFG")                 .disabled = "true";                      document.getElementById("sudo")                 .innerHTML = "Button is Disabled";         }      </script> </body> | 
Output:
 
Disable button element dynamically
 
				 
					


