JSFiddle - React, Tailwind, and code Playground
HTML
<select class="select_box">
<option class="itemone" value="0">Your device is turned OFF</option>
<option class="itemtwo" value="1">Your device is turned ON</option>
</select>
CSS
.select_box
{
color: white;
background-color: red;
}
.itemone
{
background-color: red;
}
.itemtwo
{
background-color: green;
}
JavaScript
$(document).ready(function() {
$(".select_box").change(function(){
if($(".select_box").find(":selected").val() == '1'){
$(".select_box").css('background','green');
}
else{
$(".select_box").css('background','red');
}
});
});