Use jquery filter :gt(0)
to exclude first element.
$('[id]').each(function () {
$('[id="' + this.id + '"]:gt(0)').remove();
});
Or select all the available elements, then exclude the first element using .slice(1)
.
$('[id]').each(function (i) {
$('[id="' + this.id + '"]').slice(1).remove();
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…