My answer is limited to this:
"- at least which html element my mouse clicked on"
Theory: capture the event click
throughout the body of the site; return the element clicked on this event through the property .target
.
Practising:
$('body').on('click', function(event){
let elementoClicado = $(event.target);
elementoClicado.css('background-color', '#ddd');
console.log(elementoClicado); // objeto jQuery!
console.log(event.target); // objeto html
});
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Sunt, eum, iusto. Magnam reprehenderit praesentium et aperiam consectetur. Deleniti nihil minus, architecto, molestiae rem amet placeat odio numquam dolorum pariatur deserunt!</p>
</body>
</html>
Although it doesn’t seem very functional, you can try using the same technique with the hover
. But I’m telling you: it’s not very nice. Maybe you can adapt to your use defining well a selector. But here it comes:
$('*').hover(
function(event){ // Mouse entrou no elemento
let elementoHover = $(event.target);
elementoHover.css('background-color', '#ddd');
},
function(event){ // Mouse saiu do elemento
let elementoHover = $(event.target);
elementoHover.css('background-color', '#d00');
}
);
Recommended reading: W3schools - onmouseover Event