Clone table row but not first td - jQuery
I am having some problem using the clone function in 开发者_JS百科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 ?
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();
精彩评论