JSFiddle - React, Tailwind, and code Playground

by Luis Valle

HTML

<div onmouseover="changeBackground('red');" onmouseout="changeBackground('yellow');" onmousedown="changeFontColor('green');" onmouseup="changeFontColor('orange');">
        Move your mouse over this text, then move it out
    </div>

CSS

div {
            font-size: 24px;
        }

JavaScript

function changeBackground(newColor) {
		console.log(newColor);
  	document.getElementsByTagName('div')[0].style.background = newColor;
}

function changeFontColor(newColor) {
	document.getElementsByTagName('div')[0].style.color = newColor;
}