JSFiddle - React, Tailwind, and code Playground
HTML
<input type="radio" name="elemainfoto" value="1" />
<input type="radio" name="elemainfoto" value="2" />
<input type="radio" name="elemainfoto" value="3" />
<input type="submit" onclick="doCheck()" />
JavaScript
var radio = document.getElementsByName('elementinfoto'); console.log(radio); // get all radio buttons
var isChecked = 0; // default is 0
for(var i=0; i<radio.length;i++) { // go over all the radio buttons with name 'elementinfoto'
if(radio[i].checked) isChecked = 1; // if one of them is checked - tell me
}
// if(isChecked == 0) // if the default value stayed the same, check the first radio button
// radio[0].checked = "checked";