This is a problem I’m running into and I’m not quite sure how to approach it.
Say I have a paragraph:
"This is a test paragraph. I love cats. Please apply here"
And I want a user to be able to click any one of the words in a sentence, and then return the entire sentence that contains it.
You first would have to split your paragraph into elements, as you can’t (easily) detect clicks on text without elements :
Note that it splits correctly paragraphs like this one :
Then you would bind the click :
Demonstration
I don’t know if in English
:is a separator between sentences. If so, it can be added to the regex of course.