JSFiddle - React, Tailwind, and code Playground
HTML
<body id="demo">
<button type="button" onclick="chC();">change</button>
</body>
JavaScript
function chC() {
var cl = document.getElementById('demo');
var colNo = Math.ceil(Math.random() * 4);
switch (colNo) {
case 1:
cl.style.background = 'red';
break;
case 2:
cl.style.background = 'yellow';
break;
case 3:
cl.style.background = 'pink';
break;
default:
cl.style.background = 'orange';
}
}