JSFiddle - React, Tailwind, and code Playground

HTML

<h1 id="myText">This is my text</h1>
<h6 id="itsColor">Its color is: </h6>
<button id="hiThere">Click me</button>

JavaScript

document.getElementById('hiThere').addEventListener('click',function () {
    document.getElementById('myText').style.color = '#ff0000';
    var theColor = document.getElementById('myText').style.color;
    document.getElementById('itsColor').innerHTML += theColor;
});