JSFiddle - React, Tailwind, and code Playground

HTML

<div  id="btnChangeColor" >Click<br/></div>
<span id="spanText" style="background-color: red">This is a test</span>

JavaScript

$(function() {
    $("#btnChangeColor").click(function () {
    $("#spanText").attr("css", { backgroundColor: "gray" });

     });

});