Hi!
I am trying to select the first row of a table. Note: the first row is wrapped in a thead
tag, so:
<table>
<thead>
<tr> <!-- first row --> </tr>
</thead>
<tbody>
<tr> <!-- body --> </tr>
</tbody>
<tfoot>
<tr> <!-- body --> </tr>
</tfoot>
</table>
The 'select first row' tip could work if it wasn't for the wrapper tags. This is what I have tried but doesn't work:
$("*:not(thead)", tableSelector).remove();
I.e., I would like to get rid off both tbody and tfoot selectors using a "not tfoot" selector. Because I want to remove everything else from the table except the <thead>
and everything-inside-thead. So basically what I am trying to do is to select everything except thead and what's inside it; intutuively something like :not(thead *)
could work, but doesn't.
My workaround is $("tbody, tfoot", tableSelector).remove();
but I would like to learn and understand how to use the opposite (not-selector).