I have 2 questions. First of all, this is not my job. I am currently looking at other JavaScript files. I canβt give the exact code, but I can show what interests me.
I see a lot in JavaScript files $(document).ready(function(){});. I know what it does $(document).ready, the callback function will be called when the DOM tree is loaded. Is there a reason someone would use more than one callback $(document).ready? I do not understand.
In addition, another thing I saw was $(window).loadinside $(document).ready, for example:
$(document).ready(function() {
$(window).load(function() {
});
});
From what I know, it $(window).load()is called when the entire content of the page is loaded, for example, assets and images, etc. I would think that $(window).load()- this is the last thing that is called after $(document).ready. Is there a time when $(window).loadBEFORE is called $(document).ready, and is there a reason why you would put $(window).loadinside a $(document).ready?
source
share