Hello
There is a code
(function(){ 'use strict'; loadContentToHead function(){ var head = document.querySelector('head'); var containerScriptToHead = document.createElement('div'); containerScriptToHead.id = 'containerScriptToHead'; head.appendChild(containerScriptToHead); var xhr = typeof XMLHttpRequest != 'undefined' ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); xhr.open('get', 'file-scripts.html', true); xhr.onreadystatechange = function() { if (xhr.readyState == 4 && xhr.status == 200) { head.innerHTML = xhr.responseText; } else{ console.log('Error'); } } xhr.send(); } loadContentToHead(); })();
Now everything works, but creates a
div
(the validator complains)
In
html
which is loaded, is the script, so to use the script can't