I have a field in a list with the type drop down. It is supposed to show available countries which works. However, there are a lot of annoying duplicates of the same country. How do I remove them?

  • 2
    cant you remove them from the source? Jul 28, 2014 at 13:53
  • Yeah, that is the issue. The field does a look up on another list with several items of same country. I cannot remove these items since they have other fields containing unique values.
    – Pontehh
    Jul 28, 2014 at 13:57
  • isn't "Enforce unique values" an option? I mean, you can always try to do it on the DOM, but I guess the best way would be to fix root of the problem Jul 28, 2014 at 14:04
  • I am afraid that there is nothing to fix since the list is intentionally made so that several items with the same country can be added. I was just telling you the reason why I cannot delete those items since they have other fields with text that is unique. The field "country" in that list (and by that list I mean the source) is just used to group them.
    – Pontehh
    Jul 28, 2014 at 14:16
  • in that case, you can always use jquery Jul 28, 2014 at 14:21

2 Answers 2


although I believe there would be benefit in sharing the whole background information in order to brainstorm non DOM manipulation, here is a possible solution to remove duplicates

var usedNames = {};
$("select[name='company'] > option").each(function () {
    if(usedNames[this.text]) {
    } else {
        usedNames[this.text] = this.value;


  • I forgot to mention that I was interested in a solution without using any external programs, other than SP and SPD 2010.
    – Pontehh
    Jul 29, 2014 at 12:36
  • I have zero knowledge of javascript. Where am I supposed to put the code..?
    – Pontehh
    Jul 29, 2014 at 13:29
  • you have to embed your script withing a script tag. you can edit the page and add it or use a content editor webpart. you will have to try for yourself Jul 29, 2014 at 13:46
  • All right. I think I might have found a workaround though, so I might as well try that first.
    – Pontehh
    Jul 29, 2014 at 14:05

you can use jquery to remove duplicate value temporary while its showing to user take all the values of dropdown in an array and match the values if its present in an arrray if yes delete the particular array and again bind all the array to dropdown using jquery

  • 1
    and you managed to write all of that without a single comma :p Jul 28, 2014 at 14:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.