Skip to content

Instantly share code, notes, and snippets.

@glennyboy glennyboy/jQuery Remove Duplicates Secret
Last active Jul 2, 2019

Embed
What would you like to do?
jQuery Remove Duplicates
jQuery(document).ready(function() {
// remove duplicates
var seen = {};
$('ul li').each(function() {
var txt = $(this).text();
if (seen[txt])
$(this).remove();
else
seen[txt] = true;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.