考虑以下标记:
考虑以下标记
<div id = "parent">
<a id = "child1" href = "#">1</a>
<a id = "child2" href = "#">2</a>
<a id = "child3" href = "#">3</a>
<a id = "child4" href = "#">4</a>
</div>
我需要通过位置(X和Y坐标)获取父元素中的子元素。当我使用var element = document.elementFromPoint(x, y);
时,它返回父元素。有没有办法获取子元素?
X
和Y
值来为子元素提供参考,以便我们更容易理解问题? - undefined