jQuery split a table into two tables at a particular row number

后端 未结 2 1296
广开言路
广开言路 2021-01-06 06:04

I need to split a table into two tables at a particular row number using jQuery. Can this be done?

I googled but couldn\'t find anything. jQuery\'s pretty powerful,

2条回答
  •  被撕碎了的回忆
    2021-01-06 06:27

    This can also be done with clone()

    var $mainTable = $("table.mainTable");
    $mainTable.clone().appendTo($mainTable.parent()).find('tbody tr').slice(0, 4).remove();
    $mainTable.find('tbody tr').slice(4).remove();
    

提交回复
热议问题