I'm developing a Chrome extension. I need to clear a popup, the usual way I would do that is to change the contents of body to " " with document.getElementsByTagName('body')[0].innerHTML = '';
But I cannot do this because all content is in a javascript file.
I display some images using the following (just with varying images and styling): var img = document.createElement("img"); img.src = "info_screen.png"; img.alt = 'Information Screen'; document.body.appendChild(img);
I need to clear the popup, the issue is that I cannot use the above mentioned method (due to there being a lack of an HTML file). I looked into possibly clearing the contents of the function that included that code yet all I could find was How do I clear the content of a div using JavaScript? and Creating an element that can remove it self? yet neither suit my situation due to one asking to clear the contents of div (I don't even have an html file) and the other being to create an element that removes itself as opposed to a function. I have tried countless times to adapt the second method to function for my use-case yet none seem to succeed. How would I go about clearing the contents of this popup?