JSFiddle - React, Tailwind, and code Playground

by Cwalkdawg

HTML

<div><a href="path/documents/hello.pdf">test hello</a>

    <img src="path/hello.jpg" />
<span>hello</span>

<span>hello</span>
 <span>Hello</span>

</div>

JavaScript

$(document).ready(function () {
    $('body *').each(function () {
        var children = this.childNodes;
        if (children.length === 1) {
            if (children[0].nodeType === 3) {
                var text = $(this).text();
                $(this).html(text.replace(/((H|h)ello)/gi, '$1<sup>&#174;</sup>'));
            }
        } else {
            for (var i = 0; i < children.length; i++) {
                if(children[i].nodeType===3) {
                    var text = $(this).text();
                $(this).html(text.replace(/((H|h)ello)/gi, '$1<sup>&#174;</sup>'));
                }
            }
        }
    });
});