I've seen some code where they just do this:
$().ready(function() { ... });
This is shorter than doing a document selector but is it the same thing?
Slight change:
$(document).ready(function() {});
Is equal to:
$(function() {});
As of jQuery 1.4: $().ready(function() { }); no longer works correctly in all cases. From the release notes:
$().ready(function() { });
As of jQuery 1.4, if you pass no arguments in to the jQuery() method, an empty jQuery set will be returned. In previous versions of jQuery, a set containing the document node would be returned.
2.1m questions
2.1m answers
60 comments
57.0k users