JSFiddle - React, Tailwind, and code Playground
by Sumit Patel
HTML
<body>
<button onclick="createDiv()">Click</button>
</body>
CSS
html,body
{
width: 100%;
height: 100%;
}
.div1 {
width: 50%;
height: 50%;
background-color: #000000;
float:left;
}
JavaScript
function createDiv() {
var div_created = document.createElement("div");
div_created.setAttribute("class", "div1");
document.body.append(div_created);
}