I have a table that looks something like this:
<table>
<tr id="1">
<td>bla</td>
</tr>
<tr id="2">
<td>bla</td>
</tr>
<tr id="3">
<td>bla</td>
</tr>
<tr id="4">
<td>bla</td>
</tr>
</table>
I also got an array according to which I should sort this table rows, say array goes something like
array= [3, 4, 1, 2];
Any tips or ideas how I can rearrange rows with jquery/javascript to match the array?
Append them again, in the order you need them to be in. When you call
.appendand the element is already visible it will be removed from its current location.
http://jsfiddle.net/nZ6HJ/