I\'ve been enjoying Lynda.com\'s Jquery Essential Training, and I\'ve noticed that in the beginning the instructor uses:
Fig. 1
$(\"document\").read
The default context is the document, so if you pass in some random mumbo jumbo string that does not reference an HTML node, it will be the document.
$('fdsljkfdslj').context
is document. And because the default context is the document, this means you don't have to specify it and can just feed a function to jQuery, $(function() { });
And I think you mean $(document)
instead, since specifying the string document isn't as popular, because document
passes the real document object to jQuery. But again, this will be the same as passing nothing or mumbo jumbo string since we pass document
literally.
Yes, they are exactly the same, just aliases.
From the jQuery site:
All three of the following syntaxes are equivalent:
$(document).ready(handler) $().ready(handler) (this is not recommended) $(handler)