JSFiddle - React, Tailwind, and code Playground

HTML

<div id="content">this is a spelling eror</div>

CSS

.spell_error {
    color: red;
    text-decoration: underline;
}

JavaScript

var value = "eror";
var template = "/(" + value + ")/g";
$("#content").html($("#content").html().replace(template, '<span class="spell_error">$1</span>'));