I am trying to build a tool that allow people to get word or a phrase (on select), the select part is done but not the word part.
I need to be able to get the current word when someone click on a word, and i found this solution
unfortunately, this code change all the words and add a <span>
for every words, which causes an issue on my side since i cannot add html tags in the text (css file can be imported or added dynamically)
is there's a better way to accomplish this, if possible?
EX:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec auctor ante sit amet nisl consequat volutpat.
if i click on "sit", then i will alert 'sit'