How to set different color in a select box due to selection with css

Question

I have a select box with 2 options. In the selct area the options are
green for 1
red for 2

I had been able to set green also as the color for the predefined option.
Now I would like to change this due to the incoming selection.

That means, if someone has 1 as predefined selection the color of the appearing conent of the shown select box should be green and if some has 2 as redefined selection the color of the appearing conent of the shown select box should be red.

https://jsfiddle.net/aqd7web5/2/

The whole thing only with css if possible.

Thanks in advance

0
Hansjorg Leichsenring 4 months 0 Answers 14 views 0

Leave an answer