jQuery find 2nd Table add TD
I am missing something pretty simple here, I need to add a td in the 2nd table. I cannot get it and I know its something simple. I shortened it up for i开发者_如何学运维ntense and purposes:
<div id="content_area">
<table>
<table></table>
</table>
<table>
<tr>
<td> // I want to add another TD before this
<table></table>
<table></table>
</td>
</tr>
</table>
</div>
$('#content_area').find('table:eq(1)').find('td').before('<td>Data</td>');
$('#content_area').find('>table:eq(1)').find('td').before('<td>Data</td>');
If you don't use the ">" the second table will be the one into the first table.
$('#content_area table:nth-child(2) tr').prepend('<td>Data</td>');
精彩评论