JSFiddle - React, Tailwind, and code Playground
HTML
<div>text</div>
I try to get like this:
<div><span style="color: red">text</span></div>
JavaScript
$(function(){
$('div:eq(0)').each(function(){
$(this).text($(this).html().replace(/text/, '<span style="color: red">$1<\/span>'));
});
});