I am trying to create a tool that allows people to get a word or phrase (optional), part of the selection is done, but not part of the word.
I need to be able to get the current word when someone clicks on a word, and I found this solution
get the word in points .
Unfortunately, this code changes all words and adds a <span> for all words, which causes a problem on my side, since I cannot add html tags to the text (the css file can be imported or added dynamically)
Is there a better way to accomplish this, if possible?
Example:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor ante sit amet nisl thenat volutpat.
if I click sit, then I will warn sit
source share