【发布时间】:2013-03-23 11:56:46
【问题描述】:
$('[id]').each(function () {
var ids = $('[id="' + this.id + '"]');
// remove duplicate IDs
if (ids.length > 1 && ids[0] == this) $('#' + this.id).remove();
});
上面将删除第一个重复的 ID,但我想删除最后一个。我试过$('#'+ this.id + ':last'),但无济于事。
在小提琴中,当附加操作发生时,应保留值为“sample”的输入。
【问题讨论】:
标签: javascript jquery each