Getting element name by position in DOM
I want to find the name or id of the element where I got the top and left position.
I know how to use jquery to find the position of an element (hovering over a div will cause text to appear on screen):
$(".item").hover(function () {
var eleoffset = $(this).offset();
$("#mouse").text("Mouse - Top: " + eleoffset.top + " - Left: " + eleoffset.left);
});
<div class="item">This is a text block</div>
<div id="mouse">Waiting for position data...</div>
0
a source to share