Tombol Radio Set Nilai dalam JavaScript


//must have a condition to select a value and 
//then get the element of that value individually to set it to checked.
//-you can take the value in var or get it from an object for ex. 
<div class="form-check">
  <label class="form-check-label">
    <input type="radio" class="form-check-input" name="Gender" id="male" value="Male">
      Male
  </label> 
  <label class="form-check-label">
    <input type="radio" class="form-check-input" name="Gender" id="female" value="Female">
      Female
  </label>
</div>

var targetOption='male'
if(targetOption=='female') document.getElementById("female").checked=true;
if(targetOption=='male') document.getElementById("male").checked=true;
Salsabeel woh woh