Hello,
If you have access to the template where the script tag is loaded, you could try with the onload event - I am not sure if will work, but it's work a try.
Otherwise, one other option might be the setInterval function (https://developer.mozilla.org/en-US/docs/Web/API/setInterval). You call your function multiple times, until you find the a element, then hide it and clear the interval.