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:
Requirement:
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
Example:
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 :)