JSFiddle - React, Tailwind, and code Playground

HTML

<div id="one"></div>
<div id="two"></div>

CSS

.red
{
    color: #f00;
}

JavaScript

$("#one").html("<span class='red'>Red</span>");
$("#two").text("<span class='red'>Red</span>");

alert("One as HTML: " + $("#one").html());
alert("One as TEXT: " + $("#one").text());