Coloring words in a paragraph

I want the user to be able to click on words in a paragraph. Doing so will toggle the background color. How do I catch this event?


I don’t think you can attach an evet listener to a text node. But I’m thinking maybe you could take that string, go through it and for each word you need the user to tap on it, wrap it with a span or other element that you can attach an evento listener to.