JSFiddle - React, Tailwind, and code Playground
by Daniel Hall
HTML
<br />
<button id="button">
click me
</button>
<div id="body"></div>
CSS
#body {
background-color: white;
position: absolute;
left: 0%;
top: 0%;
width: 30;
height: 30%;
}
JavaScript
var button = document
.getElementById("button");
button.addEventListener("click", replaceIt);
function replaceIt() {
document.getElementById("button")
.style.backgroundColor = "blue";
// Change the text color.
document.getElementById("button")
.style.color = "red";
document.getElementById("body")
.style.backgroundColor = "#00770";
}