-1
I need to change the source of a system, I don’t have access to HTML, only via Google Tagmanager, so I need to change the DOM with JS.
I didn’t succeed, what’s the best way to do it?
var a = document.getElementsByTagName("head")[0];
var body1 = document.getElementByTagName("body");
newFont = document.createElement("link");
newFont.href = "https://fonts.googleapis.com/css?family=Comfortaa";
body1.appendChild(a);
a.appendChild(newFont);
.body{
font-family: 'Comfortaa', cursive;
}
Did not fail to add
newFont
ina
?– Woss
Yes, I just didn’t put in the example, but anyway it didn’t work.
– wiliamvj
Then edit the question and make an example that reproduces exactly what you did. Other than that, there is an element that has the class
body
?– Woss
Yes, I added the full code in the example.
– wiliamvj