JSFiddle - React, Tailwind, and code Playground
HTML
<p>Here is a dandy block of text to color up</p>
<p> WHOAH another paragraph</p>
JavaScript
var p_index = 0,
char_start = 10,
char_end = 21;
$('p').eq(p_index).html(function(i,currentText) {
return currentText.substring(0, char_start) +
"<span style=\"background:yellow\">" +
currentText.substring(char_start, char_end) +
"</span>" +
currentText.substring(char_end);
});