How to set different color in a select box due to selection with css
You can achieve this by adding an onchange event to your select tag. Try the code below: HTML: <select id=”derselect” onchange=”this.className=this.options[this.selectedIndex].className” class=”green”> <option class=”green”>Test 1 <option class=”red”>Test 2 </select> And your CSS: .green { color:green} .red {color:red} 🙂