Close popover
Bhavya Tyagi (Bhavya)
Coforge DPA
Senior Technical Lead
Coforge DPA
Bhavya Member since 2011 4 posts
Coforge DPA
Posted: March 25, 2020
Last activity: March 27, 2020

Get Current Cursor Position

Hi All

As part of one of the requirement it was needed to get the current cursor position in a text area. Details as below:



1.  After entering a text in a text area, user can place the cursor anywhere in between words.

2. User selects a value from a drop down

3. The drop down value should be inserted at the cursor position



User entered Text : Hello, How are you?

Cursor position is after Hello -> Hello<cursor>, How are you?

User select the drop down the user name -> ABC

User entered Text should be updated to : Hello ABC, How are you?


This solution documented here is just fo find the cursor position as using that we can update the text using it as Index.

Please share your thoughts if there is any other way to do it.

Should work for all versions.

Happy Learning :)


Pega Platform 7.1.7 Pega Platform 8.1 Low-Code App Development Cross-Industry Lead System Architect Developer Knowledge Share