Unfortunately, there's no way to do this with :nth-child()
alone, or by using CSS selectors alone for that matter. This has to do with the nature of :nth-child()
which selects purely based on an element being the nth child of its parent, as well as with CSS's lack of a parent selector (you can't select a tr
only if it doesn't contain a td[rowspan]
, for example).
jQuery does have the :has()
selector that CSS lacks, though, which you can use in conjunction with :even
(not :odd
as it's 0-indexed versus :nth-child()
's 1-index) for filtering as an alternative to CSS:
$('tr:not(:has(td[rowspan])):even')
jsFiddle preview