Showing a Result Table based on an array of Radio Buttons selected

I am new to coding and I’m in need or urgent help. I’m trying to build an online form where there are a few questions that user will need to answer and questions are done in radio button options. Based on the array of radio buttons selected, I will then need to show the results on the same page. I’m thinking of using if..else statement but it doesn’t seem to be working.

Here are my codes:

<script>

function ShowHideDiv() {

if (document.getElementById("chkCitizen").checked ? && document.getElementById("chkMale").checked ?
&& document.getElementById("chkSingle").checked ? && document.getElementById("chkEmployed").checked ?
&& document.getElementById("chkNo").checked ? )
{
    btn1.style.visibility = "visible";
        var dvtext = document.getElementById("dvtext");
        dvtext.style.display = "block" : "none";
}
else if (document.getElementById("chkCitizen") && document.getElementById("chkFemale")
&& document.getElementById("chkSingle") && document.getElementById("chkEmployed")
&& document.getElementById("chkNo")
{
    btn1.style.visibility = "visible";
        var dvtext = document.getElementById("dvtext");
        dvtext.style.display = "block" : "none";
}

    
}


function resetFunction(){
    document.getElementById("reliefChecker").reset();
}

67 thoughts on “Showing a Result Table based on an array of Radio Buttons selected”

Leave a Comment