JSFiddle - React, Tailwind, and code Playground

HTML

<div id="test"></div>

JavaScript

function test() {
    var text = document.createElement("DIV");
    text.id = "t";
    document.getElementById('test').appendChild(text);
    }

test();
var whatIjustwrote = window.document.getElementById("t");
alert(whatIjustwrote);