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
I simply tried to reuse the variable, but it didn't work. document.getElementById("n3").value = startPos;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.