JSFiddle - React, Tailwind, and code Playground
HTML
<div id="text"></div>
CSS
#text {
display: block;
border: 1px solid #bfbfbf;
height: 200px;
width: 300px;
}
#text span {
background: #bada55;
}
JavaScript
$("#text").prop("contenteditable", true);
var string = $("#text")[0].innerHTML;
$("#text").innerHTML = string.replace("design", "<span>design</span>");