I have a table structure like this:
<table1> <tbody> <tr> <td></td> ... <td> <table2> <tbody> <tr> <td></td> </tr> </tbody> </table> </td> </tr> </tbody> </table>
In javascript, I have a tbl variable with the value $(table1) , and then I want to get all the direct children of (tr) <tbody> of table1 . My code is:
$('tr', tb1)
Apparently, it returns all the <tr> elements in table1 and table2. I think I can get
$('tr', tb1).not(function(){return $(this).parent().parent()[0] != tb1;})
or such logic.
I know that $('table1 > tbody > tr') can get a direct child of tr . Sorry, I cannot use this.
Anyone have a good idea about this?
Thank.
jquery parent-child
Jason Li Sep 10 '10 at 19:19 2010-09-10 19:19
source share