Javascript examples for DOM HTML Element:Button
Button disabled Property - Find out if a button is disabled or not:
<!DOCTYPE html> <html> <body> <button id="myBtn">My Button</button> <br><br> <button onclick="disableBtn()">Disable "My Button"</button> <button onclick="enableBtn()">Enable "My Button"</button> <script> function disableBtn() {//from w ww .j a va 2 s.c o m document.getElementById("myBtn").disabled = true; var v = document.getElementById("myBtn").disabled; console.log(v); } function enableBtn() { document.getElementById("myBtn").disabled = false; var v = document.getElementById("myBtn").disabled; console.log(v); } </script> </body> </html>