title: DOM Problems, Not sure if object exists yet? JavaScript
body: <p>I'm tearing hairs with this one, beginner alert.</p>
  
  <p>Trying to build a basic quiz using straight JS and not JQuery, not having much luck.</p>
  
  <p>I can't figure out how to correctly loop through the radio buttons to check for user selection. I'm pretty sure I've got the code right, but it's not working.</p>
  
  <p>Is it something to do with the fact the 'name' in question is being generated by .innerHTML so technically non-existent on page load?</p>
  
  <p>Here's a JSFiddle: <a href="http://jsfiddle.net/AU2ve/" rel="nofollow">http://jsfiddle.net/AU2ve/</a></p>
  
  <p>And here's my loop, which as I said, I'm sure is ok.</p>
  
  <pre><code>// Check which answer selected (Test)
  
  function checkAnswer() {
  
      var answerChoices = document.getElementsByName('choices');
  
      for (var j = 0; j &lt; answerChoices.length; j++) {       
           if (answerChoices[i].checked) {
               alert(answerChoices[i].value);
               break;
          }
       }
   }
  </code></pre>
  
  <p>As I said, I'm still very new to this, hopefully it's a simple solution.</p>
  
  <p>Thanks</p>