JSFiddle - React, Tailwind, and code Playground

by kohei horiguchi

HTML

<body>
 <div>
 hoge
 moge
 hage
 unk
 </div>
</body>

JavaScript

$('div:contains("hoge")').each(function(){
        var txt = $(this).text();
         $(this).html(
             txt.replace(/hoge/g,'<span style="color:red">hoge</span>')
       );
    });