Adding rows to table in a DIV
<p>I have some problems adding rows to a table in a div tag, because of another tag in it.</p>

<p>I know that it would be nice if I can change the id of the table, but because it is generated, I am not able to change them. I can only change id of the div encasing the table.</p>

<pre><code>&lt;!--Adding does not work on this table --&gt;
&lt;h3&gt;Wednesday&lt;/h3&gt;
&lt;button type="button" onclick="displayResult('wed')"&gt;Insert new row&lt;/button&gt;
&lt;div id="wed"&gt;
&lt;strong&gt;Even this stops it from adding&lt;/strong&gt; &lt;!--This is the problem --&gt;
&lt;table id="myTable" border="1"&gt;
  &lt;tr&gt;
    &lt;td&gt;cell 1&lt;/td&gt;
    &lt;td&gt;cell 2&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;div&gt;   

&lt;!--Adding works on this table --&gt;
&lt;h3&gt;Thursday&lt;/h3&gt;
&lt;button type="button" onclick="displayResult('thu')"&gt;Insert new row&lt;/button&gt;
&lt;div id="thu"&gt;
&lt;table id="myTable" border="1"&gt;
  &lt;tr&gt;
    &lt;td&gt;cell 1&lt;/td&gt;
    &lt;td&gt;cell 2&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;
&lt;div&gt;   

function displayResult(number) {
    var elemList=document.getElementById(number).childNodes;
    var table=elemList[1];
    var row=table.insertRow(-1);
    var cell1=row.insertCell(0);
    var cell2=row.insertCell(1);
    cell1.innerHTML="New";
    cell2.innerHTML="New";
}
</code></pre>

<p><a href="http://bit.ly/13SYyPc" rel="nofollow">Here is jsFiddle illustrating the problem I have</a></p>
