Is there a difference between $().ready() and $(document).ready()

jquery

Solution

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:

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.

Problem

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?

Original source

Related problems