JSFiddle - React, Tailwind, and code Playground
HTML
<div></div> <span></span> <a></a> <blah></blah>
<p id="status">Wait for it... or enable JavaScript.</p>
CSS
div, span, a, blah {
display: inline-block;
height: 20px;
margin: 5px;
width: 20px;
}
JavaScript
var currentElement = null;
document.addEventListener('mouseover', function (e) {
currentElement = e.target;
});
var colors = 'red orange yellow green blue purple'.split(' ');
$('div, span, a, blah').each(function() {
$(this).css('background-color', colors[Math.random() * colors.length | 0]);
});
setInterval(function() {
$('#status').text('The current element is ' + (currentElement && currentElement.nodeName) + '.');
}, 500);