title: insertRow JavaScript not recognized
body: <p>I'm new to javascript but still tend to try fixing an issue myself. However, I got frustrated because the same function works for a slightly different HTML without <strong>tbody</strong> and <strong>thead</strong>.</p>
  
  <p>The error I get is --> Uncaught TypeError: Cannot read property 'insertRow' of null.</p>
  
  <p>Where am I wrong? Also probably there is a better way to add a table row? I tried <strong>.append</strong> but it did not work for me.</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;table class="table table-striped myTable"&gt;
      &lt;button class="btn btn-primary btn-lg" id="addTableRow"&gt;Add table row&lt;/button&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Surname&lt;/th&gt;
              &lt;th&gt;Email&lt;/th&gt;
              &lt;th&gt;City&lt;/th&gt;
              &lt;th&gt;Sex&lt;/th&gt;
              &lt;th&gt;Date&lt;/th&gt;
              &lt;th&gt;Time&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt; 
          &lt;tr id="firstRow"&gt;
              &lt;td&gt;John&lt;/td&gt;
              &lt;td&gt;Morgan&lt;/td&gt;
              &lt;td&gt;mail@mail.com&lt;/td&gt;
              &lt;td&gt;London&lt;/td&gt;
              &lt;td&gt;Male&lt;/td&gt;
              &lt;td&gt;09.12.14&lt;/td&gt;
              &lt;td&gt;04:17 a.m.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>JavaScript</p>
  
  <pre><code>$("#addTableRow").click( function(){
  
  var table = document.getElementById("myTable");
  var row = table.insertRow(0);
  
  var cell1 = row.insertCell(0);
  var cell2 = row.insertCell(1);
  var cell3 = row.insertCell(2);
  var cell4 = row.insertCell(3);
  var cell5 = row.insertCell(4);
  var cell6 = row.insertCell(5);
  
  cell1.innerHTML = "Text-1";
  cell2.innerHTML = "Text-2";
  cell3.innerHTML = "Text-3";
  cell4.innerHTML = "Text-4";
  cell5.innerHTML = "Text-5";
  cell6.innerHTML = "Text-6";
  
  });
  </code></pre>