Sorry if this has been answered before but all searches talk about the differences, not about using the two together, if possible.
Simply, can $(window).load.(
I ran into this problem recently... from jQuery version 3, we can no longer put $(window).on('load') inside document.ready()... because ready handler are called asynchronously, which means ready can be called after load.
From jQuery Core Team: Github: jQuery 3 issues
To be clear, we understand what's causing this. We recently made ready handlers fire asynchronously. This has advantages that are hard to give up. The disadvantage is that the ready handler can sometimes fire after the load event if the load event fires quickly enough. The side effect you're seeing in this issue is that you're binding a load event handler after the load event has already fired.
The fix is to bind the load outside of ready.
This is how the two methods should be called:
$(function() {
// Things that need to happen when the document is ready
});
$(window).on("load", function() {
// Things that need to happen after full load
});