What is the difference between Window.load and document.readyState

window.load triggered when your page completely loaded (with images, banners, etc.), but document.readyState triggered when DOM is ready


window.load - This runs when all content is loaded, including images.

document.ready - This runs when the DOM is ready, all the elements are on the page and ready to do, but the images aren't necessarily loaded.

Here's the jQuery way to do document.ready:

$(function() {
  CheckThis();
});

If you wanted to still have it happen on window.load, do this:

$(window).load(function() {
  CheckThis();
});

The ready handler executes as soon as the DOM has been created, without waiting for all external resources to be loaded.

Since you've using jQuery, a more concise, browser agnostic, and widely used syntax for it is:

$(function(){  
   CheckThis();
});