Clone table row but not the first td - jQuery

I am having a problem using the clone function in jQuery. I was able to clone the table header (first row). But I also need to remove the first element from the string (th), I have tried many things, but continue to fail, here is one of my attempts:

$('.teamStatusTable tr:first:not("th:first-child")').clone().prependTo($('#tableTrackActual'));

Does anyone know a method that works?

0
source share
1 answer

If you clone the entire tr, then it will contain all its children. You can clone an element, and then remove()the offending element-element.

$('.teamStatusTable tr:first').clone().prependTo(...).find('th:first-child').remove();
+2
source

Source: https://habr.com/ru/post/1775618/