Possible Duplicate:
Different forms of $(document).ready
What is the difference between these jQuery ready functions?
What is the difference between the following two functions?:
$(function() { });
and
$(document).ready(function(){});
Possible Duplicate:
Different forms of $(document).ready
What is the difference between these jQuery ready functions?
What is the difference between the following two functions?:
$(function() { });
and
$(document).ready(function(){});
.ready is a handler function for use once the DOM is ready
The .ready() method is generally incompatible with the attribute.
I would use $(function() {});
normally.
$(document).ready(function(){});
is typically used for anonymous functions
All three of the following syntaxes are equivalent:
$(document).ready(handler)
$().ready(handler) (this is not recommended)
$(handler)