First off, I stored all my trs with a function, and then I selected part of the trs with this, opening them:
// tr = all my stored trs
tr.find("input[value='Selecteren']").click();
// This .click() function changes the input value to "Aanvragen"
Now I want to move all the clicked tr's to the top of my table body.
//$("#village_troup_list tbody")
Getting all the tds is quite simple:
tr.find("input[value='Aanvragen']").closest('tr').each(function() {
//Move every tr
})
But how do I move them?
Html structure:
$("#village_troup_list tbody").prepend(tr.find("input[value='Aanvragen']").closest('tr'));
This works because every tr is viewed as a single tr, and not as a number of trs. So it moves them instead of cloning :)