I have a ContentEditable Section. I want to get what the user selects, and then replace it with a new string.
So I will want the start and end of selected string, remove the old string, put the new string in place (will be longer).
Example:
Typed String: 'Hello, World!'
Selected String: 'World'
String to replace with: '** World **'
I want to add 'stars' around that selected word, like StackOverflow does for making text bold.
I have read countless questions on StackOverflow, but none could answer this question. And I have tried so many snippets which don't work. :P.
Note: I'm using jQuery.
Thanks.