JQuery has a method that can help you when developing a website called “document.ready”, in JQuery language: “$(document).ready()“. This method let’s you start doing things in your page using javascript once the document is ready but without having to wait for all the images to load.
I mean, if you don’t use JQuery and you want to do something like an effect or whatever when the page loads, you will for sure use the window.onload to start it, but if you have used this option in the past you will notice that window.onload needs the entirely page to be loaded, and sometimes due to images or something that is being requested to another server this takes some time making the effect less impressive or even regrettable.
So JQuery gives you another method, document.ready, that will check when the document is ready to work with and start doing whatever you tell him at that moment, making the effect faster to be shown.
I’ll show you an example
$(document).ready(function(){ $("a").click(function(event){ alert("Thanks for visiting!"); }); });
But this is not only an useful method, but THE method, since most of the things you are going to do with JQuery need the page to be loaded, you will need to place many times a call to document.ready before doing anything at all in the page.