0

I need to find the position of a text in webpage, i.e. at what height is that text written on a webpage.

We can find the position of elements with their class names, example: to find position of element with class name 'demo_class' using below code

var xt = $('.demo_class').position()

The above code will give you the value of xt as below:

{top: 9606.859375, left: 15}

Similarly, i need to find the position of text 'Find position of this text' from top of webpage, something like

var xt = $('Find position of this text').position()
  • #mods the answer is asking about absolute y-axis position. Therefore the duplicate-answer recommendation is not correct. This question can still be considered duplicate, but for a different answer: https://stackoverflow.com/a/14387497/887092 – Kind Contributor Jul 06 '20 at 12:06
  • No !! My question is completely different than the link you shared. I have specifically mentioned that i don't want to use the element or div ID / class. I need to find at what height is my 'text' written on a webpage i.e. the absolute y-position of 'text' on webpage, without knowing which element or div it is in. – Abbas Raza Jul 07 '20 at 05:29

0 Answers0