Can someone please help to modify the following code to run as simple js function from a button, and show the the highlighted text and its position in another textarea? I've tried to use the variables appearing in console.log. But it didn't work. the source of the code
https://stackoverflow.com/questions/60359921/how-to-get-highlighted-text-position-from-textarea