Hi guys, hope you're all well!
I have a chunk of HTML (with some in-line CSS) within a HtmlText control. I'd like to be able to replace parts of the code on a button click. For example, if I click on a button I'd replace the string 'color:red', with 'color:blue'.
I've tried putting the string into a variable and have tried Replace/Substitute with no luck.
Any guidance would be appreciated, thank you!
To achieve dynamic replacement of parts of an HTML string with inline CSS in a HtmlText control, you can follow these steps:
Create Variables: Create two variables to hold your HTML content and the modified HTML content:
ClearCollect(HtmlContent, "<div style='color:red;'>Your content here</div>");
ClearCollect(ModifiedHtmlContent, HtmlContent);
Here, HtmlContent holds the original HTML content, and ModifiedHtmlContent will hold the modified HTML.
This will update the ModifiedHtmlContent variable with the modified HTML string.
if this helps can you hit the thumbs up and if it’s resolved your issue set this as the solution
Many thanks
Andrew
Sorry guys, I may have jumped the gun on this one. Using a variable to replace the colour name does actually work however it won't display until the entire web page is refreshed.
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2