Javascript DOM HTML Input Radio disabled Property set

Introduction

Disable a radio button:

document.getElementById("cats").disabled = true;

Click the button to disable the radio button.

View in separate window

<!DOCTYPE html>
<html>
<body>

Radio Button: <input type="radio" id="myRadio"><br>
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//w w w  . j a  va 2  s .  c o m
  document.getElementById("myRadio").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a radio button should be disabled, or not.

This property mirrors the HTML disabled attribute.

Value Description
trueThe radio button is disabled
false Default. The radio button is not disabled

The disabled property returns true if the radio button is disabled, otherwise it returns false.




PreviousNext

Related