JSFiddle - React, Tailwind, and code Playground
HTML
<span class="demo"><script id="testScript">alert("My original span next");</script></span>
CSS
.demo {
border: 2px green solid;
background-color: #BFB;
width: 300px;
height: 50px;
display: inline-block;
}
JavaScript
$('#testScript').html('example text');