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
Considering this document (fiddle):
some text here
lalala
bla bla
And this code:
$(document).on('click', function(evt) {
var elem = document.elementFromPoint(evt.clientX, evt.clientY);
console.log(elem);
});
When you click anywhere inside the tag, the tag element itself is logged. However, when the surrounding text is clicked, the is returned because text fragments are not considered elements.
Conclusion
It's not possible to accomplish what you want with elementFromPoint() and because text fragments don't receive click events, I don't think it's possible at all.