Help get this topic noticed by sharing it on Twitter, Facebook, or email.

How do I find the text cursor's x/y coordinates?

Whenever the selection range is collapsed, I want to show a little hover-dialog type of thing with some options depending on where the text entry position is and I would like to position it right above (or below) the caret. The closest / most similar thing I can think of would be the little copy/paste thing that pops up on iOS devices.

The only way I can think of to get the top and left coordinates would be to add an invisible little span element similar to what already happens with br.GENTICS_ephemera, get the position using jquery and then hide it again later.

Is there a better/simpler way?
1 person has
this question
+1
Reply