Remove duplicate elements


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. var seen = {};
  2. $('div.related div a').each(function() {
  3. var txt = $(this).text();
  4. if (seen[txt])
  5. $(this).remove();
  6. else
  7. seen[txt] = true;
  8. });

URL: http://stackoverflow.com/questions/2822962/jquery-remove-duplicate-elements

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.