0
Why this JavaScript code doesn't work
I think i do the correct way, but what wrong on my code https://code.sololearn.com/WPkIw8WMTmra/?ref=app
2 odpowiedzi
+ 3
EsaKurniawan
Because className returns node list. Since there is only one element with that class so it should be like this:
document.getElementsByClassName("whatever")[0].innerHTML = "Why it's doesn't work";
But don't forget to write js code inside this function:
window.onload = function () {
}
------
window.onload = function () {
document.getElementsByClassName("whatever")[0].innerHTML = "Why it's doesn't work";
}
+ 2
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ thanks it's work now