So jQuery() is is a function and document is an object which is used as a parameter of the jQuery() function.
I suppose, the jQuery(document) function then return an object, which has a ready() method? Is it correct? What kind of object does jQuery(document) return then?
jQuery uses a lot of magic (e.g. to avoid the need of using
new).jQuery(...)always creates a new jQuery object, containing zero or more elements (depending on the arguments) passed to it.jQuery has a
readymethod so you can call it on any jQuery object. It doesn’t matter if you use$().ready()or$(document).ready()or$('whatever').ready()– it will always do the same thing:As you can see,
thisis only returned for chaining – the actual logic of the function does not use it at all.