Input Checkbox disabled Property - Disable and enable a checkbox: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Checkbox

Description

Input Checkbox disabled Property - Disable and enable a checkbox:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Checkbox: <input type="checkbox" id="myCheck">

<button onclick="disable()">Disable checkbox</button>
<button onclick="undisable()">Enable checkbox</button>

<script>
function disable() {//w  ww.ja  va2  s  .c  o  m
    document.getElementById("myCheck").disabled = true;
}

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

</body>
</html>

Related Tutorials