Javascript DOM HTML Input Radio disabled Property get

Introduction

Find out if a radio button is disabled or not:

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

Radio Button: <input type="radio" id="myRadio">

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

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

<script>
function myFunction() {//  w w w. jav a2 s .  co  m
  var x = document.getElementById("myRadio").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related