title: window.onload not working for very simple page
body: <p>Hi I'm new to Javascript and I'm trying to get a function to remove some elements once the window has loaded. </p>
  
  <p>Here is the HTML</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Simple Quiz&lt;/title&gt;
      &lt;script type="text/javascript" src="script.js"&gt;&lt;/script&gt;
      &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;Quiz&lt;/h1&gt;
      &lt;h2&gt;Question&lt;/h2&gt;
      &lt;p id="question"&gt;&lt;/p&gt;
      &lt;form name="choices"&gt;
          &lt;fieldset&gt;
              &lt;!-- insert questions here dynamically via javascript! --&gt;
              &lt;label&gt;&lt;input type="radio" name="choice" value="1st"&gt;First-class&lt;/label&gt;
              &lt;label&gt;&lt;input type="radio" name="choice" value="2day"&gt;2-day Air&lt;/label&gt;
              &lt;label&gt;&lt;input type="radio" name="choice" value="overnite"&gt;Overnight&lt;/label&gt;
          &lt;/fieldset&gt;
      &lt;/form&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The function removeQuestions() works fine when called in the console after the page has loaded but I can't seem to get it to work using the onload event for the window.  Interestingly enough, it works on JSFiddle (found <a href="http://jsfiddle.net/VJD8m/1" rel="noreferrer">here</a>) but not when I fire up the page locally in chrome. What am I not getting right? Thank you</p>
  
  <p>Here is the script.js file:</p>
  
  <pre><code>// JS executed after window has been loaded
  function removeQuestions() {
      var choices = document.forms.choices.elements[0].children;
  
      // remove choices
      while (choices.length &gt; 0) {
          var choice = choices[0];
          choice.parentNode.removeChild(choice);
      }
  }
  
  window.onload = removeQuestions();
  </code></pre>