JSFiddle - React, Tailwind, and code Playground

HTML

<select>
    <option class="Red">Red</option>
    <option class="Blue">Blue</option>
    <option class="Green">Green</option>
    <option class="Yellow">Yellow</option>
</select>
<div id="output"></div>

CSS

.Red{background-color:#ff0000;}
.Blue{background-color:#0000ff;}
.Green{background-color:#00ff00;}
.Yellow{background-color:#ffff00;}

JavaScript

$("select").change(function(){
    var origBGColor=$(this).attr("class");
    
    $(this).removeClass($(this).attr('class'))
           .addClass($(":selected",this).attr('class'));
    
    $("#output").html("original bg color = "+origBGColor+"<br/>Selected BG Color = "+$(":selected",this).attr('class')+"<br/>Current Select BG color = " + $(this).attr('class'));    
});