본문 바로가기

JAVASCRIPT_JQUERY

Table row 위치 변경 스트립트

728x90
$(document).on('click', 'a.move',function(e) {
var row = $(this).closest('tr');
if ($(this).hasClass('up')){
row.prev().before(row);return false;
}else{
row.next().after(row);return false;
}
return false;
});

 

테이블 내 적용

 

< a href="#" class="move btnSmall up" >↑< /a>
< a href="#" class="move btnSmall down" >↓< /a>

728x90