Remove duplicate 's through jquery

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

I have table which is bound dynamically:


      &l         
3条回答
  •  长情又很酷
    2020-12-01 20:49

    Here you go:

    $('#btnRearrange').bind("click", function() {
    
    $("#test td").each(function () {
        var tdText = $(this).text();
    
        $("#test td")
            .filter(function () { 
                return tdText == $(this).text(); 
            })
            .not(":first")
            .remove();
    
    });
    });
    

    Try it out here:

    http://jsfiddle.net/MAnLM/3/

提交回复
热议问题
test1