JSFiddle - React, Tailwind, and code Playground
by Mawel Don
HTML
<div id="body"></div>
JavaScript
function test(){
document.getElementById('body').append('test')
alert('test')
}
function ready(fn){ //Understand what is going on between fn() and fn
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading"){
fn; //originaly fn()
} else {
document.addEventListener('DOMContentLoaded', fn);
}
}
ready(test)