JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<div>£
    <p>Some other text without currencies</p>
    <span>Currency symbol here: <em>£</em></span>
</div>

JavaScript

/* The following function 'nativeSelector()' adapted from Stack Overflow answer here:
|   http://stackoverflow.com/a/2579869/82548
|  composed by Anurag (user profile: http://stackoverflow.com/users/165737/anurag)
+-----------------------------------------------------------------------------------*/
function nativeSelector() {
    var elements = document.querySelectorAll("body, body *");
    var results = [];
    var child;
    for(var i = 0; i < elements.length; i++) {
        child = elements[i].childNodes[0];
        if(elements[i].hasChildNodes() && child.nodeType == 3) {
            results.push(child);
        }
    }
    return results;
}

var textnodes = nativeSelector(),
    _nv;
for (var i = 0, len = textnodes.length; i<len; i++){
    _nv = textnodes[i].nodeValue;
    textnodes[i].nodeValue = _nv.replace(/£/g,'€');
}