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:
move
function. You'll need to useclone()
,appendTo()
andremove()
in some order (depending upon your mark up). – Offshore$("table").find("tbody").find("tr:first").insertBefore("trs to move")
try this. – Par