JSFiddle - React, Tailwind, and code Playground
by Daniel Hall
HTML
<button id="replaceButton">green</button>
<div id="body"></div>
CSS
body {
background-color: black;
}
#body {
position: absolute;
top: 65%;
left: 30%;
width: 30%;
height: 30%;
background-color: red;
}
JavaScript
var replaceButton = document
.getElementById("replaceButton");
replaceButton.addEventListener("click,replaceIt");
function replaceIt () {
// Change his body color.
document.getElementById("body")
.style.Color = "green";
}