Here is an image that relates to my query.
I have created a select box in HTML that contains colors, as shown in the image above and the code below. By using CSS, I have applied classes to color various option
elements, but how do I ensure that the selected items are also displayed in their respective colors?
In the image, red is currently selected, yet the background of the selected item remains white. Furthermore, is there a method to remove the hover effect? For instance, when hovering over the orange
item, it is highlighted in blue. (Please note that JavaScript and jQuery are used to populate the selector after clicking a button.)
<div class="selection">
<select id="color">
<option class="selectionpurple" value="purple">purple</option>
<option class="selectionblue" value="blue">blue</option>
<option class="selectionred" value="red">red</option>
<option class="selectiongreen" value="green">green</option>
<option class="selectionorange" value="orange">orange</option>
</select>
</div>