Reputation: 515
Hello i have A table inside a table like that :
<table id="t4">
<tr>
<td></td>
<td></td>
<td></td>
<td> //Here Another Table </td>
</tr>
</table>
To render a chart i use in javascript this code to get data
var obj, table = $("#t4"), array = [];
table.find('tbody tr').each(function() {
var rows = $(this).find('td:nth-child(' + columnOrder +')');
rows.each(function(){
obj = {};
obj[keyName] = $(this).text();
array.push(obj);
});
});
return array;
}
The problem is, this line is going to get data also from the table inside my table.
I would like to limit that javascript code to the outside table.
Upvotes: 0
Views: 32
Reputation: 207557
Change your selector to only select the rows and cells of direct children
table.find('> tbody > tr')
and
.find('> td...
Upvotes: 1