Input Button disabled Property - Disable and enable a button: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Button

Description

Input Button disabled Property - Disable and enable a button:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="button" id="myBtn" value="My Button">
<br>

<button onclick="disableBtn()">Disable "My Button"</button>
<button onclick="undisableBtn()">Enable "My Button"</button>

<script>
function disableBtn() {/*  www  .ja v a  2 s  .  c om*/
    document.getElementById("myBtn").disabled = true;
}

function undisableBtn() {
    document.getElementById("myBtn").disabled = false;
}
</script>

</body>
</html>

Related Tutorials