Javascript Code 3 Lines to Get Element Under Mouse

Javascript Code to Get the Element that is Currently Under the Mouse Cursor

Home Short:

In the example below you can change the selector from all elements * to whichever elements you wish to restrict the detection of mouseenter events. For example if you only want to get notified when the mouse is over elements with class="example", change the line document.querySelectorAll("*") to document.querySelectorAll(".example").

S
H
A
R
E