title: Javascript dynamically add elements
body: <p>I'm trying to dynamically add table rows using Javascript (I will add Ajax requests later on), but I'm having the following error: <code>Uncaught Error: NOT_FOUND_ERR: DOM Exception 8</code></p>
  
  <p>My code is as follows:</p>
  
  <pre><code>function SplitsJob() {
  
  var newJob = document.createElement("tr");
  newJob.innerHTML = "&lt;tr&gt;&lt;td&gt;Foo&lt;/td&gt;&lt;td&gt;Bar&lt;/td&gt;&lt;/tr&gt;";
  
  var under = document.getElementById("row1");
  document.body.insertBefore(newJob, under);
  }
  </code></pre>
  
  <p>When this function is called, I want to add another <code>&lt;tr&gt;</code> (with the contents of <code>newJob.innerHTML</code>) beneath the <code>&lt;tr&gt;</code> with the id <code>row1</code>.</p>
  
  <p>I have found the code on <a href="https://developer.mozilla.org/en/document.createElement" rel="nofollow">this Mozilla page</a></p>