Javascript Form How to - Disable a Button








Question

We would like to know how to disable a Button.

Answer


   
    
<html>
<body>
<button onclick="this.disabled='true'; console.log(this.isDisabled);">Disable Me</button>
</body>
</html>

The code above is rendered as follows: