Multicolor color choice of selected background | CSS

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

0
drop-down-menu
source share
1 answer

Link

CSS does not currently support this feature. You can create your own or use a plugin that emulates this behavior using DIVs / CSS.

However, you can achieve this using 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); 
+1
source share

All Articles