+ 1
Script error
I dont know why this code works on a laptop, but it fails here for the script https://code.sololearn.com/WIezmSpLcCr9/?ref=app
4 ответов
+ 4
onload = function() {
document.getElementById('aparatCarts').innerHTML=html;
}
+ 4
Because the JavaScript codes on JS pane is injected into head tag node.
It run the JavaScript codes before DOM is successsfully loaded.
Thus allow it to be called back by onload function would make sure the DOM is loaded before executing the codes.
0
Calviղ
tanks man its work 😍🙏
0
Calviղ But why should I use onload here?