Can anyone help me. I have a table containing a nested table in one of the cells. I want to append “hello world!” to the first cell in each row of the outer table (so in the below html I want to append to cells 1a and 2a only). I tried the following:
$("div > table > tr > td:first-child").append(' Hello World!');
on the below html:
<div class="divClass">
<table class="tableClass" border="1px">
<tr>
<td>1a</td>
<td>1b</td>
</tr>
<tr>
<td>2a</td>
<td>2b
<table border="1px"><tr><td>nested table cell</td></tr></table>
</td>
</tr>
</table>
</div>
but it doesn’t work. ( – http://jsfiddle.net/NickyW/x3bqf/ )
Any suggestions?
Thanks,
Nick
You need to just use
tbodybecause it added to table by browser. This is more reliable.DEMO