JQuery 选中表格一行

CSS


.test_table tr:hover{
    background:#7cbcfc
}
.tr_selected{
    background:#7cbcfc
}

JS


$(".test_table tbody").on('click', 'tr', function () {
    $(this).siblings('tr').removeClass('tr_selected');
    $(this).addClass('tr_selected');
});

效果

JQuery 选中表格一行

猜你喜欢

转载自blog.51cto.com/weiyuqingcheng/2550328