How do I get the current cursor position in a lightning:inputrichtext field?

Say an event is triggered and I want to insert text at the cursor. What does the js look like?

  • 1
    Can you please show the code, what you have tried so far. Jul 29, 2017 at 11:16

1 Answer 1


I believe it is not possible because you need to get hold of the cursor position of the lightning:inputRichText which is not exposed either by attribute or by action as of now, also it's part of lightning namespace so you cannot read the DOM due to Locker Service.

If you are using HTML textarea tag (need to manually do the data binding stuffs), then you achieve the behavior as explained in this SO thread

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .