I have java script widged which also serves advertisement logo and link. I'm trying to remove the link. Tried the following script code:
<script>
const element = document.querySelector('#apps-google-reviews-1db34d2f-5a02-5eb0-a222-cec57773ac19 > div > a');
element.remove();
</script>
This is working in the browser's console but when I add it as a script in the HTML there is the following error in the console:
Uncaught TypeError: Cannot read properties of null (reading 'remove')
Basicaly the selector didn't catch the element.