且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

查找表中的重复行

更新时间:2023-02-26 15:07:07

阅读此帖子:

基于帖子,这是一个示例:

Based on the post this is an example:

function removeD(w){
    var seen = {};
    if(w == 'val'){
        $('table tr td').each(function() {
            var txt = $(this).text();
            if (seen[txt])
                $(this).remove();
            else
                seen[txt] = true;
        });
    }else{
        $('table tr td').each(function() {
            var id = $(this).attr('id');
            if (seen[id])
                $(this).remove();
            else
                seen[id] = true;
        });
    }
}

$('#removeID').click(function(){
    removeD('id');
});



$('#removeVal').click(function(){
    removeD('val');
});

小提琴