I have 3 js files with scripts. But they conflict together. Works only one script. I connect all of them inside head tag. Each of them have such code for waiting when window to load
((window, document) => {
window.onload = () => {
// code
}
})(window, document, undefined)
May it be reason of conflicts? When all code in one file it works good.
You can only have ONE onload. Instead use an eventListener for each of them
((window, document) => {
window.addEventListener("load", () => {
// code
})
})(window, document, undefined)