Check if they're checked with the el.checked
attribute.
let radio1 = document.querySelector('.radio1');
let radio2 = document.querySelector('.radio2');
let output = document.querySelector('.output');
function update() {
if (radio1.checked) {
output.innerHTML = "radio1";
}
else {
output.innerHTML = "radio2";
}
}
update();
_x000D_
<div class="radios">
<input class="radio1" type="radio" name="radios" onchange="update()" checked>
<input class="radio2" type="radio" name="radios" onchange="update()">
</div>
<div class="output"></div>
_x000D_