What is a better workaround to this, rather than repeating the if statement numerous times for 10 different elements?
Html:
 <div id="rightWrongContainer">
        <div id="q1" class="rightWrong"></div>
        <div id="q2" class="rightWrong"></div>
        <div id="q3" class="rightWrong"></div>
        <div id="q4" class="rightWrong"></div>
        <div id="q5" class="rightWrong"></div>
        <div id="q6" class="rightWrong"></div>
        <div id="q7" class="rightWrong"></div>
        <div id="q8" class="rightWrong"></div>
        <div id="q9" class="rightWrong"></div>
        <div id="q10" class="rightWrong"></div>
    </div>
Js:
     if (counter == 1 && answer == userInput){
            var green = document.getElementById("q1").style.backgroundColor="green";
          }
          else {
            var red = document.getElementById("q1").style.backgroundColor="red";
          }
    if (counter == 2 && answer == userInput){
            var green = document.getElementById("q2").style.backgroundColor="green";
          }
          else {
            var red = document.getElementById("q2").style.backgroundColor="red";
          }
    if (counter == 3 && answer == userInput){
            var green = document.getElementById("q3").style.backgroundColor="green";
          }
          else {
            var red = document.getElementById("q3").style.backgroundColor="red";
          }
and so on...
Edit: see this image My project
Each time a user submits their answer, I want the divs (circles in image link) to change according to if the answer is correct hence 'answer == userInput' but also the right div has to equal the right number of question so I have created a counter so I know what question the user is on but i dont want to create an if statement for every element ' counter == 1 , counter == 2 and so on...
 
     
     
    