jQuery find table rows but ignore rows in child tables
I have the following code to alternate row background-images of a table...
$("table:not([class])").each(function () {
$(this).find("tbody tr:even td").css({
"background-image": "url(/images/rowBg1.png)"
});
$(this).find("tbody tr:odd td").css({
"background-image": "url(/images/rowBg2.png)"
});
});
This works fine most of the time, but if I have a situation where there is
a child table in one of the cells and it's carrying on selecting those
rows.
I need it to only select the rows in the table in the each function.
Any ideas?
No comments:
Post a Comment