JSFiddle - React, Tailwind, and code Playground

by Tri Nguyen

HTML

<p id="red">Red</p>
<p id="blue">Blue</p>
<button id="click" type="button">Click</button>

JavaScript

document.getElementById("red").style.color = "red";
document.getElementById("blue").style.color = "blue";
document.getElementById("blue").style.backgroundColor = "black";


document.getElementById("click").onclick = function () {
    document.getElementById("red").style.color = document.getElementById("blue").style.color;
    document.getElementById("blue").removeAttribute("style");
};