0

I'm writing a chrome extension that edits the text contained within certain elements on a page. One of the elements is in a popup div and so isn't rendered into the DOM (sorry if wrong terminology) until the popup is triggered. As a result querySelector() can't find the element to change it. Is there a way around this? I can only edit the chrome extension and not the source code of the page. Appreciate may not be possible.

Thanks

  • Thanks but I'm using querySelector() from a chrome extension content.js. So I have no control over when it loads the DOM – user1627774 Feb 14 '23 at 19:12
  • Test the return value of `querySelector()`. If it returns `null` then just return since the popup hasn't been added yet. – Barmar Feb 14 '23 at 19:12

0 Answers0