I want to create multiple HTML select elements with unique background colors for each option:
<select runat="server" id="select">
<option value="A">White</option>
<option value="B">Red</option>
<option value="C">Yellow</option>
<option value="D">Green</option>
Upon loading the website, I aim to have the select element only show the background color without text for the selected option. The text (white, red, etc.) should only appear when the dropdown is open.
When a user changes the selected value, the background color should also change while keeping the text invisible in the closed dropdown.
I would appreciate it if the solution is compatible with most browsers, including IE 9/10.
Cheers.