JSFiddle - React, Tailwind, and code Playground
HTML
<div id="d1">One</div>
<div id="d2">Two</div>
<div id="d3">Three</div>
<div id="d4">Four <p>This is a <strong>(and bold)</strong> paragraph</p> within a div</div>
JavaScript
which_element_is_the_mouse_on = (function() {
var currentElement;
$("body *").on('mouseover', function(e) {
currentElement = this;
e.stopImmediatePropagation();
});
return function() {
console.log(currentElement);
};
}());
setInterval(which_element_is_the_mouse_on, 1000);