How to check an HTML radio button using JavaScript

1 Answer

0 votes
<input type="radio" name="radio1" value="radio1" id="radio1"/>
<label for="radio1">radio1</label>

<input type="radio" name="radio2" value="radio2" id="radio2"/>
<label for="radio2">radio2</label>
const radioBtn = document.querySelector('#radio2');

radioBtn.checked = true;
  
    
      
      
/*
run:



*/

 



answered Jun 16, 2021 by avibootz

Related questions

...