JSFiddle - React, Tailwind, and code Playground
HTML
<div id="mydiv">sjdfajkbhjcxcx</div>
JavaScript
window.onmouseover = function (e) {
mouseOver(e)
};
document.getElementById("mydiv").onmouseout = function (e) {
mouseOut(e)
};
function mouseOver(e) {
if (e.target.nodeName === "DIV") {
alert("it's a div");
}
}
function mouseOut() {
document.getElementById("mydiv").style.color = "black";
}