Javascript examples for DOM HTML Element:Input Button
The disabled property sets or gets whether an input button is disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a input button should be disabled or not |
A Boolean, returns true if the input button is disabled, otherwise it returns false
The following code shows how to Disable a button:
<!DOCTYPE html> <html> <body> <input type="button" id="myBtn" value="My Button"> <button onclick="myFunction()">disable the button above</button> <script> function myFunction() {//w ww .j a v a 2 s . c om document.getElementById("myBtn").disabled = true; } </script> </body> </html>