CODE CODIFY.CLUB

jQuery Select dropdown duplicate value remove

$(‘select’).blur(function() {
    var myOpt = [];
    $(“select”).each(function () {
        myOpt.push($(this).val());
    });
    $(“select”).each(function () {
        $(this).find(“option”).prop(‘hidden’, false);
        var sel = $(this);
        $.each(myOpt, function(key, value) {
            if((value != “”) && (value != sel.val())) {
                sel.find(“option”).filter(‘[value=”‘ + value +'”]’).prop(‘hidden’, true);
            }
        });
    });
});

V!ral

Developer, Technology aficionado, Beer Lover and founder of codify.club Network. Who shares a keen interest about website development, health issues, cancer awareness and other fun stuff.

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed