0
Why is this not working?
2 Answers
+ 4
onload=()=>{
var elem = document.getElementsByClassName("of");
elem[0].innerHTML = "GJR SKDVSI";
};
+ 1
Because JavaScript runs before an html document is loaded.
And since you are accessing the collection of html elements, (getElements...), you need to specify the index of the element you are interested in, even if it is one.