JSFiddle - React, Tailwind, and code Playground

by Dan2357

HTML

<script>
  function myFunction() {

    var elements = document.getElementsByClassName("child1");
    var el = document.getElementById("myCheck");

    for (var i = 0; i < elements.length; i++) {

      if (e1.checked)) {
      elements[i].removeAttribute("disabled");
    } else {
      elements[i].setAttribute("disabled", "disabled");

    }
  }
  }

</script>
<input type="checkbox" id="myCheck" onClick="myFunction()">Click the button to disable the form input elements
<br>


<input type="radio" class="child1" name="group1" disabled="disabled">
<input type="radio" class="child1" name="group1" disabled="disabled">
<input type="radio" class="child1" name="group1" disabled="disabled">
<br>
<input type="radio" class="child1" name="group2" disabled="disabled">
<input type="radio" class="child1" name="group2" disabled="disabled">
<input type="radio" class="child1" name="group2" disabled="disabled">
<br>
<input type="text" class="child1" disabled="disabled">