Widely available Supported across all major browsers. Safe to use in production.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
1
12
3
4
18
3.2

The elementsFromPoint() method of the Document interface returns an array of all elements at the specified coordinates (relative to the viewport). The elements are ordered from the topmost to the bottommost box of the viewport.

43
79
46
11.1
43
11.3
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Implementation note
  • Before Chrome 66, this method returned `null` when the element was a child of a host node. See bug 40537452.
Notes 1 item(s)
Implementation note
  • Before Chrome Android 66, this method returned `null` when the element was a child of a host node. See bug 40537452.
Notes 1 item(s)
Implementation note
  • Before Chrome 66, this method returned `null` when the element was a child of a host node. See bug 40537452.
Notes 3 item(s)
Removed
  • This feature was removed in a later browser version (79)
Compatibility
  • Available with a vendor prefix: ms (12)
Implementation note
  • Returns a `NodeList` instead of an array. See the MSDN documentation. Returns `null` when the point provided has no elements beneath it (e.g., when given a point outside the document).
Notes 1 item(s)
Implementation note
  • Before Chrome Android 66, this method returned `null` when the element was a child of a host node. See bug 40537452.

Syntax

JAVASCRIPT
elementFromPoint(x, y)

Use cases

  • Using document.elementFromPoint() and document.elementsFromPoint()

    The elementFromPoint()

Cautions

  • May not be supported in older browsers.

Implementation notes

  • Some APIs require a secure context (HTTPS) or user activation. Check the requirements before use.