title: Getting the value of "on" for radio buttons
body: <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var allQuestions = [{
    question1: "What is 1 + 1?",
    choices: ["1", "2", "3", 4],
    correctAnswer: ["2"]
  }, {
    question2: "What is 2 + 2?",
    choices: ["6", "2", "3", 4, ],
    correctAnswer: ["4"]
  }, {
    question3: "What is 3 + 3?",
    choices: ["3", "6", "9", 12],
    correctAnswer: ["6"]
  }];
  
  var newArray = shuffleArray(allQuestions);
  
  function shuffleArray(array) {
    for (var i = array.length - 1; i &gt; 0; i--) {
      var j = Math.floor(Math.random() * (i + 1));
      var temp = array[i];
      array[i] = array[j];
      array[j] = temp;
    }
    return array;
  }
  
  function appendQuestions(number) {
    if (newArray == "undefined" || newArray == "null" || newArray.length == 0) {
      document.getElementById("questionForm").innerHTML = "Complete!";
    } else {
      for (i = 0; i &lt; 4; i++) {
        $("#questionForm").append("&lt;input name='question' type='radio'&gt;" +
          JSON.stringify(newArray[0].choices[i]) + "&lt;/input&gt;")
      }
    }
  }
  
  $(function() {
    $("#questionList").empty();
    appendQuestions();
    newArray.shift();
  })
  
  function isCorrectAnswer() {
    checkedVal = $("input[type=radio][name=question]:checked").val();
    if (checkedVal == newArray[0].correctAnswer) {
      alert("Correct!");
    } else {
      alert("Wrong!");
    }
    alert(checkedVal);
  }
  
  $("#submitButton").click(function() {
    isCorrectAnswer();
    $("#questionForm").empty();
    appendQuestions();
    newArray.shift();
  })</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;div class='container'&gt;
    &lt;section id='questions'&gt;
      &lt;form id="questionForm"&gt;
      &lt;/form&gt;
      &lt;div style='clear:both'&gt;&lt;/div&gt;
      &lt;input id='submitButton' type='button' value='Submit'&gt;
    &lt;/section&gt;
  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>First off, sorry for the amount of code pasted. I have no idea if I'm missing some small bug or if I'm just writing the wrong code, so I figured it would be best to post all of it.</p>
  
  <p>I am trying to get the value of a radio button. In the isCorrectAnswer function the first 2 lines are to determine the value of the radio button that is currently checked. The problem is when I alert the value of the radio button, it just says "on". I have searched for the last hour trying to figure out what this means or how to fix it and could not find a thing.</p>
  
  <p>I apologize if this is a stupid question or if it has already been answered.</p>