How to use Element.setAttribute() to disable HTML <button> tag in JavaScript

1 Answer

0 votes
<!DOCTYPE html>
<html>
<head>
</head>
<body>

<button>JavaScript</button>
<script type="text/JavaScript">   


var bt = document.querySelector("button"); 

bt.setAttribute("disabled", "disabled");


 
/*
run:  
  

   
*/
 
    
</script>
</body>
</html>

 



answered May 23, 2016 by avibootz

Related questions

...