Removing duplicates from dropdown using javascript
<p>I'm currently removing duplicates from a dropdown menu using the following script, but I now need to try to remove all duplicates apart from the LAST option to enable the search criteria to be remembered by Solspace's Freeform.</p>

<p><strong>Does anyone cleverer than me know how to adjust the script to remove all duplicates APART from the last one?</strong></p>

<pre><code>// REMOVE DUPLICATES FROM LOCATION DROPDOWN
var optionValues =[];
$('#locationList option').each(function(){
   if($.inArray(this.value, optionValues) &gt;-1){
      $(this).remove()
   }else{
      optionValues.push(this.value);
   }
});
</code></pre>

<p>Thanks in advance,</p>

<p>Tom</p>