Using jQuery to find an element at a particular position?

You are looking for the .elementFromPoint() JavaScript/DOM method.

var elem = document.elementFromPoint(100, 100) // x, y

That returns a DOM node, which of course then can be wrapped into a jQuery object:

$(elem).remove(); // for instance

I’m not that aware about the cross-browser compatibility and I would like some guys who know better to edit this post or write a comment about it.

Reference: .elementFromPoint()

Example Link: http://www.jsfiddle.net/YjC6y/22/

Leave a Comment