Reputation: 1551
I am having some problem using the clone function in jQuery. I have been able to clone the table header (first row). But I also need to remove the first element from the row (th), I have tried quite a few things but keep failing, here is one of my attempts:
$('.teamStatusTable tr:first:not("th:first-child")').clone().prependTo($('#tableTrackActual'));
Does anyone know a method that works ?
Upvotes: 0
Views: 3022
Reputation: 179166
If you're cloning the entire tr, then it'll include all of its children. You can clone the element and then remove()
the offending element element.
$('.teamStatusTable tr:first').clone().prependTo(...).find('th:first-child').remove();
Upvotes: 2