Compare two tables rows and remove if match

前端 未结 2 1338
孤独总比滥情好
孤独总比滥情好 2021-01-03 03:46

Could anyone help me please in JQuery? I have two tables on my site leftTable and rightTable with same column names. The leftTable

2条回答
  •  梦谈多话
    2021-01-03 04:44

    Just an idea

    $(function(){
        $('#btn').on('click', function(e){
            $('#right_table tbody tr').each(function(){
                var row=$(this).html();
                $('#left_table tbody tr').each(function(){
                    if(row==$(this).html()) $(this).remove();
                });
            });
        });
    });​
    

    DEMO.

    I've already mentioned it's an idea only because you didn't provide any code (HTML) so remember that both tables should heve same (class/id) in the rows if they have any.

提交回复
热议问题