JSFiddle - React, Tailwind, and code Playground

by Filippo Bracci

HTML

<form id="myForm">
    
  <h3>Test Form</h3>

  
  
  <input type="radio" name="radiobutton" id="needabikesino0" onclick="enableDisableAll();" /> Yes
  <input type="radio" name="radiobutton" id="needabikesino1" onclick="enableDisableAll();" /> No
  
  
    <p><input type="text" id="numerobiciclette" name="mybikes" placeholder="bike numbers" disabled /></p>
    <p><input type="text" id="altezza" name="myheight" placeholder="my height" disabled /></p>
    <p><input type="text" id="numerocaschi" name="myhelmets" placeholder="my helmets" disabled /></p>
    

</form>

JavaScript

function enableDisableAll() {
    cb1 = document.getElementById('needabikesino0').checked;
    document.getElementById('numerobiciclette').disabled = !cb1;
    document.getElementById('altezza').disabled = !cb1;
    document.getElementById('numerocaschi').disabled = !cb1;
}