Hey Tristan,
The reason it shows “text1” as an error, is probably because you don’t have a component with that name. You should change the name to fit your site, in this specific case just read on.
Before I talk about fixing the styles, I’d like to point out that you should probably take the whole “onMessage” clause (lines 20 - 27) and move that to after line 10. All the function calls named “onMessage” should be called only once. (The current implementation says that every time you click button15, you add an additional response to the html component, which I assume is not what you want to do, and rather just define the response behavior to the html component once)
Now for where to stick the code snippet. Line 23 says: “use the event data from the HTML component to set the field value descriptionmod in the dataset”. If I understand correctly what you’re trying to do, it’s that event data that you want to tweak. Replace line 23 with the following two lines:
const dataWithFixedLinkStyles = event.data.replace(/\<a/g, `<a style="color:#0782C1;text-decoration:underline"`);
$w('#dataset1').setFieldValue("descriptionmod", dataWithFixedLinkStyles);
I think that should do the trick.
Let me know how it went ![]()
J.