On Thu, Nov 6, 2008 at 2:36 AM, Satyakaran <[EMAIL PROTECTED]> wrote:
> > > function load() { > //jQuery(function($) { > $("#div1").load("starterkit.html"); > //}); > } This one calls the .load() immediately. > > > OR > > function load() { > jQuery(function($) { > $("#div1").load("starterkit.html"); > }); > } This one waits to call .load() until the DOM is loaded. This is shorthand syntax for jQuery(document).ready(function($) { ... }); which says "call this function I provide as soon the document/DOM is ready". This guarantees that your element #div1 is available for selecting and manipulation. So the difference depends on where your function load() is being called. If it's called after the page is loaded (say, by a button click) there will be no difference. If it's called during the page load (say, in the head) you'll want the latter. For more info see http://docs.jquery.com/How_jQuery_Works#.24.28document.29.ready.28function.28.29.7B.7D.29.3B - Richard