I want to replace specific tags by using JavaScript.
The labels I want to replace are these <!--
and -->
. Between these two labels I have code that will be executed when the page is fully loaded.
This is my code:
function listen(){
var html = document.getElementsByTagName('html')[0];
[].slice.call(html).forEach(function(el, i){
el.innerHTML.replace('<!--', '<script>').replace('-->', '</script>');
});
}
window.addEventListener('DOMContentLoaded', function(){
listen();
}, false);