+ 11
How do I make JS wait untill HTML is fully loaded?
On SoloLearn's code playground: I couldn't control canvas with JS, unless I put whole JS code in inline script. Is there any way that would work with external JS script?
5 Respostas
+ 13
To call js once the window is loaded use:
window.onload = function(){
// Some code that is called when the document is loaded
}
+ 11
You can use this too ...
<body onload="your_defined_function()">
..........
</body>
+ 7
or this in es6:
onload = () => {
// Some code
}
+ 3
window.onload = () => {
}
0
$(document).ready(() => {}); if you use JQuery