Mike Roosa
Mike Roosa

Reputation: 4802

How do I change the background color of the selected items in a multiple select box?

I have a regular html select field. When a user selects an item from the list, it is added to a multiple select field and marked as selected. If the user clicks on one of the items in the multiple select field it is removed. What I want to do is override the default colors of the multiple select field so that selected items have a black background.

I tried using css and the option[selected] tag but that doesn't seem to work. I can easily change the background color of the select box but not the individually selected items. What do I need?

Upvotes: 0

Views: 1567

Answers (1)

Eduardo Molteni
Eduardo Molteni

Reputation: 39413

Only some browsers have support for the [selected] rule, you can simulate the behavior using some plugin like this combobox plugin

Upvotes: 1

Related Questions