Javascript – Change option background color on hover

hoverjavascriptjquery

How can I change the background color when user hovers it ? I have tried this but it's not working.

<select>
<option>bmw</option>
<option>audi</option>
<option>mercedes</option>
</select>



$('option').hover(function(){
$(this).css("background-color","#FFFFCC");
}); 

Best Solution

You cannot use option in this way. The best solution would be styling something similar with <ul> and <li> and interacting with JS.