Javascript DOM HTML Input Radio disable and enable

Introduction

Disable and enable a radio button:

View in separate window

<!DOCTYPE html>
<html>
<body>

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

<button onclick="disable()">Disable radio button</button>
<button onclick="enable()">enable radio button</button>

<script>
function disable() {//from  ww  w .j a  v  a 2  s.c om
  document.getElementById("myRadio").disabled = true;
}

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

</body>
</html>



PreviousNext

Related