Disable and enable a button:
<!DOCTYPE html> <html> <body> <input type="button" id="myBtn" value="My Button"> <br> <button onclick="disableBtn()">Disable "My Button"</button> <button onclick="enableBtn()">enable "My Button"</button> <script> function disableBtn() {//w ww . ja va2 s . c o m document.getElementById("myBtn").disabled = true; } function enableBtn() { document.getElementById("myBtn").disabled = false; } </script> </body> </html>