hy
I have an issue. I have 4 radio type input, and i want them to be checked which one is selected on my JS function to show a different panel depends on this choice. My problem is when i have to write in my function, in the parameter, how to check if my radio input has been selected or not.
This is my current function (not working):
function function1(){
if (document.getElementsByClassName("btn1").is(":checked")){
document.getElementById('div2').style.height = '200px';
}
else{
document.getElementById('div2').style.height = '0px';
}
}
<label><input class="btn1" type="radio" name="optradio">Option 1</label>
<label><input class="btn1" type="radio" name="optradio">Option 1</label>
<label><input class="btn1" type="radio" name="optradio">Option 1</label>
<label><input class="btn1" type="radio" name="optradio">Option 1</label>
<button id="btn" onClick="function1()">example 1</button>