Possible Duplicate:
What is the difference between these jQuery ready functions?
I have always used:
$(document).ready(function (){
//Code goes here
});
And inserted my jQuery/JavaScript code therein (so that it waits on the html page to be fully loaded before running any code).
Lately, I have seen this:
jQuery(function($){
//Code goes here
});
I have searched for what the difference is here (mainly what the 'jQuery' part is all about).
My questions:
- What does the
jQuery
part of the latter code block do, if anything? - What is the '($)' argument doing for that function?
- Is there even a difference (other than making the page wait to be loaded) between my two code block examples?