删除其中一个相同的短语

时间:2016-01-22 17:10:26

标签: javascript jquery

我想通过.id p动态删除$.each中的一个相同短语,我尝试使用以下代码但这对我不起作用,它删除了{{1}中的所有短语}}:

怎么回事?

DEMO:http://jsbin.com/juyiwololi/



.id p

$('.id p').each(function() {
    var item = $(this).text();
    alert(item);
    $('.id p').filter(function() {
        return $(this).text() == item
    }).remove();
});




0 个答案:

没有答案