JSFiddle - React, Tailwind, and code Playground

HTML

<div id='foo'>
  <div id='bar'>Click Me</div>
</div>

CSS

#bar {
    border: 1px solid black;
    padding: 5px;
}

JavaScript

document.onclick = function(event) {
    console.log(
        document.getElementById("bar"),
        Array.prototype.slice.apply(document.getElementsByTagName("div")), 
        event.target
    );
};

document.getElementById('bar').onclick = function(event) {
    document.getElementById("foo").innerHTML = '<h1>Replaced</h1>';
    console.log('Replaced "#foo"');
};