12th Sep 2022, 6:43 PM
CuratoR
CuratoR - avatar
2 Answers
+ 4
onload=()=>{ var elem = document.getElementsByClassName("of"); elem[0].innerHTML = "GJR SKDVSI"; };
12th Sep 2022, 7:15 PM
Jayakrishna 🇼🇳
+ 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.
12th Sep 2022, 7:34 PM
Solo
Solo - avatar