Clone a <table> with specific rows and columns
I try my best to work with the following functionality, I need to clone the table, but I only need the first 'td'of each row and remove the title. Can someone point me in the right direction, I have tried several things now, but not joy. Tried a few things, such as:
$('#tableMembers').find('tr').find('td:not(first)').remove();
Which obviously didn't work.
+3
2 answers
First, you must first clone, otherwise you delete the original.
var newTable$ = $('#tableMembers').clone().find('tr').find('td:gt(0)').remove();
$('#someTargetLocation').append(newTable$);
Something in this direction should do it. td: gt (0) will find all td elements that are not the first in their row.
find ('tr') , td: gt (0) . find ('tr') find ('td: gt (0)') tr , .
+2