$(\'[id]\').each(function () { var ids = $(\'[id=\"\' + this.id + \'\"]\'); // remove duplicate IDs if (ids.length > 1 && id
Try Using The below function Works fine for me:
$('#favourities-ajax ul li').each(function(i) { $('[id="' + this.id + '"]').slice(1).remove(); });