【Bootstrap】 table表格里的某一行置顶

针对bootstrap table:
JS:

//$(this)是置顶的那个按钮
var $tr = $(this).parent('td').parent('tr');
$('#table tbody').find("tr").first().before(tr);

JQuery:

//$('.top')是置顶的那个按钮的class
var $top = $(".top");
$top.click(function(){
    var $tr = $(this).parents("tr");
    $tr.fadeOut().fadeIn();
    $("#toptable").prepend($tr);
});

猜你喜欢

转载自blog.csdn.net/it429/article/details/73369237