stackoverflow

https://stackoverflow.com/a/62578360/860099

by Lamik

HTML

Select first radio and click button
    <!-- Question html -->
    <form>
        <div id='type'>
            <input type='radio' id='radio_1' name='type' value='1' />
            <input type='radio' id='radio_2' name='type' value='2' />
            <input type='radio' id='radio_3' name='type' value='3' /> 
        </div>
    </form>

    <!-- Test html -->
    <button id="checkBtn">Check</button>

JavaScript

checkBtn.onclick = e=> {
  console.log( radio_1.checked );
}