Forum Academy Marketplace Showcase Pricing Features

Select words in a text

Hey guys!

I’m building a platform where, at the moment, I need to create a way to be able to select words in a text (not an input or multiline with text) and format it when clicking. For example, in a text on the website, I would like the user to be able to click on a random word and it would change the background color, or underline it, or make it bold… anything.

I’ve already tried using the regex to find all the words and tried to replace it with something that could have that functionality (it was as close as I got, but it’s limited to replacing each word with the same one in URL format. I couldn’t find a way to leave the clickable word). I tried to build repenting groups with the words created from a list, but the repeating group only grows vertically and not horizontally, and it would be slower to process everything.

Anyway… I’m not a professional programmer so I’m trying ways I found here on the forum, but without success. If anyone can give me a light, I will be grateful!



1 Like

Thaaanks man!!!

I’ve been trying to solve this for many days! It finally worked!

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.