JSFiddle - React, Tailwind, and code Playground
by cmbuckley
HTML
<div class="content">
<p>somecontent</p>
<p>another content <span id="name-1">content 123</span> 1234214</p>
</div>
CSS
.mathjaxfont {
color: red;
}
#name-1 {
text-decoration: underline;
}
JavaScript
jQuery('.content p').contents().each(function () {
var method = this.nodeType == 1 ? 'html' : 'replaceWith';
$(this)[method](this.textContent.replace(/(\d+)/g, '<span class="mathjaxfont">$1</span>'));
});