I saw a similar question answered before, but they were too complicated for me to understand, i want a very easy way to do it, if thats possible.
So i have 6 radio inputs. I want a function to run when one of them (whichever) is checked.
html:
<input type="radio" id="AR" name="gun"> Assault Rifles <br>
<input type="radio" id="SMG" name="gun"> Submachine Guns <br>
<input type="radio" id="SG" name="gun"> Shotguns <br>
<input type="radio" id="LMG" name="gun"> Light Machine Guns <br>
<input type="radio" id="MR" name="gun"> Marksman Rifles <br>
<input type="radio" id="SR" name="gun"> Sniper Rifles <br> <br>
script:
var alleRadio = document.querySelectorAll("input");
if (alleRadio.checked === true) {}
(The if
is inside a function that is started by a click)
As you might imagine this doesn't work, so what do I do? I need super simple answers/solutions, as I am not the best in this, thank you :D