I have two div with same x position. And i am trying to do that getting id of both divs from document.elementFromPoint(). Here is the problem that only id recieved of a div.
var elem = document.elementFromPoint(50, 50);
var elem2 = document.elementFromPoint(50, 250);
console.log(elem.id, elem2.id);
#box1,
#box2 {
width: 50px;
height: 50px;
background: greenyellow;
}
#box1 {
position: absolute;
top: 50px;
left: 50px;
}
#box2 {
position: absolute;
top: 50px;
left: 150px;
}
<div id="box1"></div>
<div id="box2"></div>