Create a Set of Checkboxes for different questions but it wont stay checked when i check other question(codepen)

i created 2 questions. each has 2 checkboxes,. I can check the first one just fine. but when i check the second button on the second question, the first button becomes unchecked… how do i fix this. below is my link to codepen where i am working on it. thank you

Because all the radio buttons have the same name, it is like you have four options for the same question. Make the name different for the second set radio buttons.

Your topic says checkboxes, but these are actually radio buttons.

1 Like

ok. i fixed it. thank your for your help. but is there anyway to still use YES-NO on multiple radio buttons? or is that out of the question?

Absolutely. See the following code. You just have to change the name attribute of the input. The label can be Yes/No for as many as you want.

    <p>Do you love animals?</p>
    <label><input type="radio" name="question1">Yes</label>
    <label><input type="radio" name="question1">No</label>
    <p>Do you care about your health?</p>
    <label><input type="radio" name="question2">Yes</label>
    <label><input type="radio" name="question2">No</label>
1 Like

Thank you!! It worked!!