{{APIRef("DOM")}}{{SeeCompatTable}}
The elementsFromPoint()
method of the {{domxref("Document")}} interface returns an array of all elements at the specified coordinates.
Syntax
var elements[] = document.elementsFromPoint(x, y);
Returns
An array of {{domxref("Element")}} objects under the given point.
Parameters
- x
- A horizontal position within the current viewport.
- y
- A vertical position within the current viewport.
Example
//TBD
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('CSSOM View', '#dom-document-elementsfrompoint', 'elementsFromPoint')}} | {{Spec2('CSSOM View')}} | Initial definition. |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | {{CompatChrome(43.0)}} | {{CompatNo}}[1] | 10.0 {{property_prefix("ms")}} | {{CompatUnknown}} | {{CompatNo}} |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | {{CompatNo}} | {{CompatChrome(43.0)}} | {{CompatNo}}[1] | {{CompatUnknown}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatChrome(43.0)}} |
[1] See {{bug(1164427)}}