I am trying to detect the position of text inside a HTML element (assume, <div>
tag) (top, left, bottom and right coordinates) on the screen. I have tried offsetLeft, and offsetWidth. But, it doesn't help. Please help.
Thanks.
I am trying to detect the position of text inside a HTML element (assume, <div>
tag) (top, left, bottom and right coordinates) on the screen. I have tried offsetLeft, and offsetWidth. But, it doesn't help. Please help.
Thanks.
You were on the right track, not sure where you got lost but you can determine coordinates using the following:
Top: node.offsetTop
Left: node.offsetLeft
Bottom: (node.offsetTop + node.offsetHeight)
Right: (node.offsetLeft + node.offsetWidth)