How can I remove inserted HTML in my chrome extension?
تبليغيرجى شرح بإيجاز لمإذا تشعر أنك ينبغي الإبلاغ عن هذا السؤال.
I have html that I insert into a webpage with my extension. The issue that I am having is figuring out how to remove all that html after the user hits the icon the second time around. I have the functionality for the clicking of the icon. Its the functionality for removing all inserted html that I am having issues with.
// This function toggles the extention on and fetches the required resources from the server.
function toggleExtOn(response) {
document.getElementById(‘gic-wrapper’).insertAdjacentHTML(“afterend”, response);
}
//This function toggles the extenson off.
function toggleExtOff() {
document.getElementById(“header”).remove();
document.getElementById(“body”).remove();
document.getElementById(“footer”).remove();
}
//In my html I have tags like such:
<head id=’header’>
As you can see from the above code I attempt to give my head body and footer tags ids and remove it all that way. This does not work. What can I do to unload all the html that was inserted?
أضف إجابة