title: Quiz tutorial, display the button "submit" only when one of the answers is checked
body: <p>I have created a quiz following a tutorial on YouTube.<br>
  I see that even if you don't select any of the option you can still proceed with the next question, so for avoid this I would like to display the button only when one of the radio button is selected. Could anyone help me to add the if statement for this.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var quiz;
  var quizStatus;
  var pos = 0;
  var correct = 0;
  var chA, chB, chC, choice;
  var question;
  var choices;
  var buttonC;
  var questions = [
    ["Who is the king of the world?", "Jakub", "Tomek", "Darek", "A"],
    ["What is the capital of Poland?", "Warsaw", "Paris", "Rome", "A"],
    ["Who is Robert Lewandowski?", "An Actor", "A football player", "A Doctor", "B"]
  ];
  
  function displayQuestions() {
    if (pos === questions.length) {
      quiz.innerHTML = "you compleate the test &lt;br&gt;";
      quiz.innerHTML += "your score is " + correct;
      quiz.innerHTML += '&lt;input type="button"  value="Restart" onclick="restartTest()"&gt;'
  
    }
  
    quiz = document.getElementById("quiz");
    quizStatus = document.getElementById("quiz-status");
    question = questions[pos][0];
    chA = questions[pos][1];
    chB = questions[pos][2];
    chC = questions[pos][3];
    quizStatus.innerHTML = "Question" + (pos + 1) + "of" + questions.length;
    "&lt;br&gt;";
    quiz.innerHTML = question + "&lt;br&gt;";
    quiz.innerHTML += '&lt;input type="radio" name="choices" value="A"&gt;' + chA + "&lt;br&gt;"
    quiz.innerHTML += '&lt;input type="radio" name="choices" value="B"&gt;' + chB + "&lt;br&gt;"
    quiz.innerHTML += '&lt;input type="radio" name="choices" value="C"&gt;' + chC + "&lt;br&gt;"
    quiz.innerHTML += '&lt;input id="buttonC" type="button"  value="Submit" onclick="submitQuestion()"&gt;'
  }
  
  function submitQuestion() {
    choices = document.getElementsByName("choices");
    buttonC = document.getElementById("buttonC");
  
    for (var i = 0; i &lt; choices.length; i++) {
      if (choices[i].checked) {
        choice = choices[i].value;
      }
    }
  
    if (choice == questions[pos][4]) {
      correct++;
    }
    pos++;
    displayQuestions();
  
  }
  
  
  function restartTest() {
    pos = 0
    correct = 0
    displayQuestions()
  }
  
  window.addEventListener("load", displayQuestions, false);</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id="quiz-status"&gt;&lt;/div&gt;
  &lt;div id="quiz"&gt;&lt;/div&gt;
  &lt;div id="result"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>