I have selectbox with multiple attribute,
<select multiple class="test">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="opel">Opel</option>
<option value="audi">Audi</option>
</select>
Options give a blue background color when focus on one of them (not on mouse over; on click or select an option).
on hover
I can change background-color. But I don't no how can I change selected item background-color.
here is my css. I test checked, focus, active
events,
.test option:hover {
background-color: #ccc;
}
.test option:checked {
background-color: #ddd
}
.test option:focus {
background-color: #ddd
}
.test option:active {
background-color: #ddd
}
also I test ::selection
but it doesn't seems works;
::selection {
background-color: red
}
I try to do it with jquery:
$('.test option').click(function() {
$(this).css('background-color', 'red');
})
but click event doesn't on select event of option.