iegorov
1/31/2014 - 9:06 AM

Filter duplicate options from select dropdown

Filter duplicate options from select dropdown

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