Remove duplicate 's through jquery

前端 未结 3 593
庸人自扰
庸人自扰 2020-12-01 20:10

I have table which is bound dynamically:


      &l         
3条回答
  •  天涯浪人
    2020-12-01 20:50

    $('#btnRearrange').bind("click", function() {
        var contents = {}, text;
        $("#test td").each(function() {
    
            text = $(this).text();
    
            if( !( text in contents ) ) {
                contents[text] = true;
            }
            else {
                $( this.parentNode ).remove();
            }
    
        });
    });
    

    jsfiddle: http://jsfiddle.net/jKs4k/

提交回复
热议问题
test1