I have a <span></span>, within which a sentence resides. Like:
<span>A sentence residing within a span</span>
Is it possible to get the coordinates of the starting and ending letters of that sentence i.e “A” and “n” respectively on a Javascript event like onmouseover attached with that span?
The span is resides within a div. So
case – I: for the sentence
This is a sentence inline
The top and left is evaluated with respect to the letter “T” of the word “This”.
case – II: for the sentence
... ... ... ... ... ... This is
a sentence broke into two lines.
The top is evaluated with respect to the letter “T” of the word “This” and the left is evaluated with respect to “a”.
Is there any way to get the coordinates of the two terminals of a sentence?
span.getBoundingClientRect()? docs