Javascript DOM HTML Input Checkbox disabled Property get

Introduction

Find out if a checkbox is disabled or not:

var x = document.getElementById("myCheck").disabled;

Click the button to find out if the checkbox is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>

Checkbox: <input type="checkbox" id="myCheck">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {//from  www.  j a v a 2 s .  com
  var x = document.getElementById("myCheck").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related