JSFiddle - React, Tailwind, and code Playground

HTML

<div id="one">
    <p><a id="clicky" href="#">Hello World</a></p>
</div>
<div id="two">
    <p>Lorem Ipsum</p>
</div>

JavaScript

var clicky = document.getElementById('clicky');
clicky.onclick = function() {
    console.log('clicked!');
    return false;
};

function append(target,node) {
    if ( typeof node === 'string' ) {
        node = document.createTextNode(node); // cast string as CDATA
    }
    target.appendChild(node);
}

function prepend(target,node) {
    if ( typeof node === 'string' ) {
        node = document.createTextNode(node);
    }
    target.insertBefore(node,target.firstChild);
}

var twoDiv = document.getElementById('two');
append(twoDiv,clicky);

var newElement = document.createElement('p');
newElement.onclick = function() {
    console.log('clicked the p');
    return false;
};
newElement.appendChild(document.createTextNode('Dolor sit amet.')); // add a CDATA node to the new P element
prepend(twoDiv,newElement);

append(twoDiv,'Waddup?');