Why the methods are inside the document ready event.

Amatya
Posted by Amatya under jQuery category on | Points: 40 | Views : 1308
JQuery methods are inside a document ready event.


$(document).ready(function(){

// jQuery methods

});


Here are some examples of actions that can fail if methods are run before the document is fully loaded:

1. Trying to hide an element that is not created yet.
2. Trying to get the size of an image that is not loaded yet.

Comments or Responses

Login to post response