Tôi muốn thay đổi thứ tự của hai hàng trong một bảng.jQuery: thay đổi thứ tự của hai hàng của một bảng
tôi có mã này:
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());
Đó là in này:
<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>
Bất kỳ ý tưởng?
Trân
Javi