How can I remove duplicate values -> drop down option elements? I have the following HTML:
All Servers
use this :
$(document).ready(function () { var usedNames = {}; $("select > option").each(function () { if (usedNames[this.value]) { $(this).remove(); } else { usedNames[this.value] = this.text; } }); });
demo here : http://jsfiddle.net/aelor/aspMT/