I have an array filled with script elements, I want to loop over them and add them to document with appendChild
methods, but even though I can see the added scripts in the inspector tab of the developer console, the scripts are not running (
for example, scripts have console.log
s inside but they’re not logging anything. Basically, scripts are not working
).
Here’s the code :
for (let i = 0; i < scriptsToBeAdded.length; i++) {
let current = scriptsToBeAdded[i];
let clone = current.cloneNode(true);
document.body.appendChild(clone);
}