Remove Duplicate Items From Multiple Ordered Lists Individually


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



Copy this code and paste it in your HTML
  1. <script type="text/javascript" charset="utf-8">
  2. $(document).ready(function() {
  3. $('ol').each(function() {
  4. var seen = {};
  5. $(this).children('li').each(function() {
  6. var txt = $(this).text();
  7. if (seen[txt])
  8. $(this).remove();
  9. else
  10. seen[txt] = true;
  11. });
  12. });
  13. });
  14. </script>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.