+ 4
Why doesnt work?
I am new to JS. Could you tell me why getElementById returns null in my code? https://code.sololearn.com/WowXLP1nO5qU/?ref=app
1 ответ
+ 5
Because the document isn't loaded when you try to get the element.
Use this instead:
window.onload = function() {
cir();
}
This will wait for the document to load before doing anything