jQuery: Eliminating duplicate elements



The jQuery Code START
    
    <script type="text/javascript" src="./jquery-1.5.1.js"></script>
    <script src="http://code.jquery.com/jquery-latest.js"></script>
  
    <script type="text/javascript">
      $(document).ready(function(){
    
        var array = $("p").get();

        array = array.concat($(".duplicateMe").get());
        $("p:eq(1)").text("There are " + array.length + " elements.");

        array = jQuery.unique(array);
        $("p:eq(2)").text("There are " + array.length + " unique elements.");

      });
    </script>
    
    <style type="text/CSS">
        <!--
        .code { color: red; }
        .back { background-color: yellow; }
        -->
   </style>
  </head>

  <body>
    <h1>jQuery: Eliminating duplicate elements</h1>
    <p class="duplicateMe"></p>
    <p class="duplicateMe"></p>
    <p class="duplicateMe"></p>
    <p></p>