-3

I have 2 HTML table. First column there are checkbox to check rows and when I click button on the top of the table it'll move data to another table. For example: Add members to the group by selecting the checkboxes in the table on the right and clicking “Add to Group”. To remove group members, select users in the table on the left and click “Remove from Group”. How can I do it. This's my screenshot

enter image description here

Aka Shiro
  • 53
  • 9

2 Answers2

1

I believe you want the .appendTo() function.

So get the selected row from the table with a suitable jquery selector, then use something like:

$('#selectedTR_goes_here').appendTo( $('#YourTable') );

appendTo() automatically detaches the element before reattaching elsewhere.

Note: this is also possible duplicate for: How to move an element into another element?

Community
  • 1
  • 1
BrianH
  • 2,140
  • 14
  • 20
0

try this

$('class').each(function(){

if($(this).is(' checked'))

     $('#otherTable tbody').append($(this).find().closest('tr).html());
});
PSR
  • 39,804
  • 41
  • 111
  • 151