JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test">
    
    <p>This is ™</p>
    
    <a href="#">This is ® something</a>
    
</div>

JavaScript

$('#test p').on('click', function() {
    alert()
});

Trademark = {
    init: function () {
        $('*').contents().each(function() {
            if (this.nodeType == 3 && this.nodeValue) {
                if ( this.nodeValue.indexOf('™') != -1 || this.nodeValue.indexOf('®') != -1 ) {
                    this.parentNode.innerHTML = this.parentNode.innerHTML.replace(/(?![^<]+>)(™|®)/gi, '<sup class="trademark">$1</sup>');
                }
            }
        });
    }
}

$(function () {
    Trademark.init();
})