I want to change the order of two rows in a table.
I have this code:
console.log(position.parent().parent().prev());
console.log(position.parent().parent());
//I expected this line do the work, but no...
$(this).parent().parent().prev().insertAfter($(this).parent().parent());
That is printing this:
<tr>
<td>Element 1</td>
<td>…</td>
<td>2008-02-02</td>
<td class="jander" data-pos="0" data-category="1">…</td>
</tr>
<tr>
<td>Element 2</td>
<td>…</td>
<td>2007-02-02</td>
<td class="jander" data-pos="1" data-category="1">…</td>
</tr>
Any idea?
Regards
Javi