JSFiddle - React, Tailwind, and code Playground
by MarmiK
HTML
<select id="mySelect" class="yellowText" onSelect="do()">
<option class="green" value="apple">Apple</option>
<option class="red" value="banana">Banana</option>
<option class="blue" value="grape">Grape</option>
</select>
CSS
option.green {
background:green;
}
option.red {
background:red;
}
option.blue {
background:blue;
}
'select{background:green}
JavaScript
$('#mySelect').change(
function () {
$('#mySelect').css("background", $("select option:selected").css("background-color"));
});