Input Checkbox disabled Property - Find out if a checkbox is disabled or not: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Checkbox

Description

Input Checkbox disabled Property - Find out if a checkbox is disabled or not:

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() {//ww w .j av a 2s . co  m
    document.getElementById("myCheck").disabled = true;
    
    var v = document.getElementById("myCheck").disabled;
    console.log(v);
}

function undisable() {
    document.getElementById("myCheck").disabled = false;

    var v = document.getElementById("myCheck").disabled;
    console.log(v);

}
</script>

</body>
</html>

Related Tutorials