I\'ve seen some code where they just do this:
$().ready(function()
{
...
});
This is shorter than doing a document selector but is it t
Nick and Justin have got the right answers here, but since we're on the topic, I would recommend for portability to never use $
in the global scope. A few too many libraries use it for their own purposes, and you could run into compatibility problems if you need to mix them up. Instead, you can use the optional first parameter to the jQuery ready handler:
jQuery(function($) {
});
This sets $
to be a reference to jQuery
in that function scope.