Get DOM text node from point?

前端 未结 4 1971
无人共我
无人共我 2020-12-30 06:49

Just like I can get an element from a point with document.elementFromPoint or document.getElementFromPoint, is it possible to somehow get a text no

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-30 07:42

    You can use element.nodeName to see if it's a text node, and then element.nodeValue for its value.

提交回复
热议问题