I\'ve seen some code where they just do this:
$().ready(function()
{
...
});
This is shorter than doing a document selector but is it t
According to the jQuery API docs, all three of the following syntaxes are equivalent:
$(document).ready(handler)$().ready(handler) (but this is not recommended)$(handler)So apparently that syntax will work, but is not the recommended syntax.
According to the jQuery 1.4 Release Notes:
In jQuery 1.3, jQuery() returned a jQuery set containing just the document. in jQuery 1.4, it returns an empty jQuery set. This can be useful for creating an empty set and adding elements to it dynamically. Note: The jQuery().ready() technique still works in 1.4 but it has been deprecated. Please use either jQuery(document).ready() or jQuery(function(){}).