Hi is it possible and how to change background color for an item in a drop down list on focus using css or javascript?
Thanks
Hi is it possible and how to change background color for an item in a drop down list on focus using css or javascript?
Thanks
If the native lists don't work for you, you can simulate a drop down list with JavaScript and an absolutely positioned DIV
and style that. Most UI frameworks have extensive lists. Check out YUI, for example.
This should work in most browsers:
<html>
<head>
<style type="text/css">
option.red {background-color:red}
option.blue {background-color:blue}
option.white {background-color:white}
</style>
</head>
<select>
<option value="item 1" class="red">Item 1</option>
<option value="item 2" class="blue">Item 2</option>
<option value="item 3" class="white">Item 3</option>
</select>
</html>
This proves that individual items can be coloured differently, but I'm not sure about changing on the OnFocus event.