JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<span>This text is a test text</span>
</div>
CSS
span{
font-size:15pt;
}
JavaScript
$('div').each(function() {
var $this = $(this);
$this.html($this.text().replace(/\b(\w+)\b/g, "<span>$1</span>"));
});
$('div span').click(
function() {
$(this).css('background-color','#ffff66');
}
);