I am currently using an event plugin that automatically links all schedule text to the main event page through anchor tags, like this:
<td><a href="http://apavtcongresso.staging.wpengine.com/event/congresso-apavt-2018/">Chegada dos primeiros congressistas</a></td>
However, I have a specific requirement to change some of these links to redirect to different pages. The challenge is that I cannot add id or classes to the <a>
element.
Is there a way for me to dynamically change the href attribute based on the text content inside the <td></td>
tags, such as "Chegada dos primeiros congressistas" in this case?
I am aware that I can replace text using
document.body.innerHTML = document.body.innerHTML.replace('Example 1', 'Change to Example 2');
, but I am unsure how to achieve the same for attributes.
Any guidance on this matter would be greatly appreciated. Thank you!