title: Page refresh, javascript not running
body: <p>I'm brand new to web programming, never played with it past a basic level and have started a small graphing project with HTML5 canvas. While beginning to build a reallu basic page I've ran into some HTML/JS stuff that's quite simple but I for the life of me cant figure out what's wrong. It wont run for some reason.</p>
  
  <p>I was originally hosting the JS in an external file but in the same directory such as</p>
  
  <pre><code>&lt;script src="numValues.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>Is this correct or best practice?</p>
  
  <p>My Markup/JS</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="eng"&gt;
      &lt;head&gt;
          &lt;META charset="UTF-8"/&gt;
          &lt;title&gt;EZgraph | Pie Chart&lt;/title&gt;
          &lt;script type="text/javascript"&gt;
   function addFields()
   {
      var numValues = document.getElementById("numValues").value;
  
      var container = document.getElementById("container");
  
      while(container.HasChildNodes())
      {
          container.removeChild(container.lastChild);
      }
  
      for (i=0; i &lt; numValues; i++)
      {
          container.appendChild(document.createTextNode("value " + (i+1)));
          var input = document.createElement("input");
                  input.type = "number";
                  input.name = "Value" + i;
                  container.appendChild(input);
                  container.appendChild(document.createElement("br"));
      }
   }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="inputCountText"&gt;&lt;/div&gt;
          &lt;form method="post" onsubmit="return addFields()"&gt;
              &lt;input type="number" id="numValues" required&gt;
              &lt;input type="submit" value="submit"&gt;
          &lt;/form&gt;
          &lt;div id="container"&gt;&lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Are there any good IDE's/setups for this kind of work on a Mac? I'm currently using SublimeText.</p>