I am trying to edit the style of a page element which is rendered by a third party script. I know I can target the elements using
const variable = document.querySelector('.class')
and then change the style using
variable.style.colorEtc = 'red or whatever';
I previously tried to just use
setTimeout(changeStyle, delay)
but the load time is unpredictable and can cause issues.
I'm wondering if there is a way to use promises and async/await to cause the query selectors and style changes to load asynchronously and then run once the targets are rendered.
I have no idea what this looks like in practice. How can I target a js render performed by third party script as the condition that the variables are awaiting to run once loaded?
I hope I understood async/await correctly, but if not, I'm open to alternative solutions.
Thanks!