-
-
Save glennyboy/ad00918f401ef0ea6396ac0d6c457915 to your computer and use it in GitHub Desktop.
jQuery Remove Duplicates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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