+ 1
Why after I created the second script code the first stopped working? (JavaScript)
2 odpowiedzi
+ 2
You are overwritting value of `window.onload` property.
If you want to add multiple EventListeners use addEventListener() method.
window.addEventListener('load', function f1(){
//code for f1
});
window.addEventListener('load', function f2(){
//code for f2
});
+ 1
🇮🇳Omkar🕉 thanks, SoloLearn should had explained these stuff in the course, they just dropped the window.onload event there without explaining anything.