JSFiddle - React, Tailwind, and code Playground

by Cwalkdawg

HTML

<div id="string">Adam Sandler was the shit back in the day</div>
<br />
<button>Fix This</button>

JavaScript

window.addEvent = function (event, target, method) {
    if (target.addEventListener) {
        target.addEventListener(event, method, false);
    } else if (target.attachEvent) {
        target.attachEvent("on" + event, method);
    }
}

var button = document.getElementsByTagName('button')[0];

addEvent('click', button, function () {
    var div = document.getElementById('string');
    var text = div.innerText;
    text = text.replace("was the","is").replace("back in the day", "");
    div.innerText = text;
});