JQuery: Remove duplicate elements?

Posted by Keith Donegan on Stack Overflow See other posts from Stack Overflow or by Keith Donegan
Published on 2010-05-12T21:42:57Z Indexed on 2010/05/12 21:44 UTC
Read the original article Hit count: 165

Filed under:
|
|

Say I have a list of links with duplicate values as below:

<a href="#">Book</a>
<a href="#">Magazine</a>
<a href="#">Book</a>
<a href="#">Book</a>
<a href="#">DVD</a>
<a href="#">DVD</a>
<a href="#">DVD</a>
<a href="#">Book</a>

How would I, using JQuery, remove the dups and be left with the following for example:

<a href="#">Book</a>
<a href="#">Magazine</a>
<a href="#">DVD</a>

Basically I am looking for a way to remove any duplicate values found and show 1 of each link.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about duplicate