I'm encountering an issue with my Chrome Extension where I am unable to detect some of the elements that I need to select within a page.
var innerChat = document.querySelector('.chat-list');
My goal is to appendChild to this element, but the problem is that the script moves on to edit it before the element even exists.
innerChat.appendChild(emoteMenuWrap);
This leads to the error:
Uncaught TypeError: Cannot read property 'appendChild' of null
What would be the best approach to resolve this issue?