JSFiddle - React, Tailwind, and code Playground
by linmic
HTML
<a href="#" id="test">test</a>
CSS
a {
font-family: Arial, sans-serif;
display: block;
text-decoration: none;
width: 100px;
height: 60px;
font-size: 20px;
line-height: 60px;
touch-action: manipulation;
text-align: center;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: red;
color: #fff;
}
JavaScript
(function() {
document.getElementById('test').addEventListener('click', function(e) {
e.preventDefault();
console.log(document.body.style.backgroundColor);
document.body.style.backgroundColor = (document.body.style.backgroundColor !== 'white') ? 'white' : 'yellow';
});
})();