How can I find current element on mouseover using jQuery?

midstack picture midstack · Feb 20, 2014 · Viewed 93.6k times · Source

How can I get the class name of the current element that is on mouseover? For example enter image description here

When a mouse is over from div to a, I want to get the class name of a div element. How can I get it using jQuery?

Answer

Adesh Pandey picture Adesh Pandey · Feb 20, 2014

you can give a try to this:

window.onmouseover=function(e) {
        console.log(e.target.className);
};