> Is it the norm to start any page that uses JQuery with:
>
> $(document).ready(function(){
>      // Your code here
>    });
>
> All of the tutorials mention it so I'm just trying to figure out if its
> just something to help get us started or if its a best practice.
>
> Also, does all of the code used to manipulate pages and execute Ajax
> calls get placed within this method? How are others organizing/breaking
> out their code?

Essentially, anything that interacts with or manipulates the page must
be within the $(document).ready() function. This is considered a "best
practice" - the only alternative is to wrap your code in a
$(window).load( ... ), but that is highly un-optimal.

> Apart from learning how to develop using JQuery, I'm also trying to
> learn the best practices of using JQuery. Are there any resources that
> discuss this?

I'm not entirely sure what the page would discuss - considering that
$(document).ready() is in just about every jQuery example. In the end,
it's up the developer how they want to "wait for the DOM to load" -
jQuery just provides an incredibly simple, and efficient, means of
doing this.

I guess, could explain what you'd expect from a best practices page?

--John

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to