I'm developing an app using Ionic Framework. In my app I want to detect when a word was pressed. I tried to adapt and implement this solution, where you split the string in words and generate a span with a click event for every word.
The problem comes when the string contains a large number of words: hundreds or thousands, and generating so many spans with a click event would take more memory and time (besides as I already tested, the application moves quite slow on a large string).
So is there any other way to get a click event that would return the clicked word, without generating lots of spans?
I mention that I do not need to obtain a highlight effect, only to get the clicked word as a string.
Any help or idea would be much appreciated.