Skip to content Skip to sidebar Skip to footer

Multi Select Box Selected Background Color

I would like to change the color of selected item's background. I mean that blue color : http://img844.imageshack.us/img844/3200/c0b8e4b9ceac4122bc5668a.png

Solution 1:

Referencing this post,

Currently CSS does not support this feature. You can build your own or use a plug-in that emulates this behaviour using DIVs/CSS.

However you can achieve it doing Javascript which you can see here

var sel = document.getElementById('select_id');
sel.addEventListener('click', function(el){
    var options = this.children;
    for(var i=0; i < this.childElementCount; i++){
        options[i].style.color = 'white';
    }
    var selected = this.children[this.selectedIndex];
        selected.style.color = 'red';
    }, false);

Post a Comment for "Multi Select Box Selected Background Color"