What is the difference between
$(document).ready(function(){});
AND
$(window).load(function(){});
What is the difference between
$(document).ready(function(){});
AND
$(window).load(function(){});
From the docs:
Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. Code included inside $( window ).load(function() { ... }) will run once the entire page (images or iframes), not just the DOM, is ready.