0

I am having an iframe in design mode to implement an text editor. Now i need to know when the user inputs some text and have to know the cursor position before and after the input.

To get the current cursor position i use getSelection() of the window object which works fine. To get the position before the text input i use the before keydown event which also works fine.

The problem is that i don't find the correct event to get the position after the text was entered. I already tried after keydown and before/after keypress but within these events the old position is returned and not the new one. Before/after keyup would return the correct (new) position but this is to late and leads to a deplay in the UI.

Is there any further event i could use or any workaround to get the new cursor position before keyup event?

Werzi2001
  • 2,035
  • 1
  • 18
  • 41

0 Answers0