JSFiddle - React, Tailwind, and code Playground
HTML
<div id="theWord">tjurkey</div>
CSS
.highlight {
background: yellow;
}
JavaScript
var $target = $('#theWord'),
t = ''
$("body").keypress(function(e) {
if (e.which !== 0) {
t += String.fromCharCode(e.which);
var text = $target.text(),
pos = text.search(t);
if(pos > -1){
$target.html(text.substring(0,pos)+'<span class="highlight">'+t+'</span>'+text.substring(pos+t.length));
}else{
$target.text(text);
}
}
});