JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">Test text</div>
    <input type="button" id="changer" value="Change to Blue">
    <span id="styleContainer"></span>

JavaScript

$(document).ready(function(){
        $('#styleContainer').append('<style>#test{ color: red; }</style>');
        
        $('#changer').on('click', function() {
            $('#styleContainer').append('<style>#test{ color: blue; }</style>');
        });
    });