$(document).ready(); vs $('document').ready(); what is the difference?

Can someone please explain to me the difference between




Notice that there are no quotes within the first document block.


$(document) passes the document element to JQuery.

$(‘document’) passes the CSS selector ‘document’ to JQuery.

Neither is necessary as the ready method in jQuery should no longer be called directly.

You should either use:


which implicitly runs the ready method or if the JavaScript is at the bottom of the page you can use:


and so run the code straight away without needing to test ready.

thank you for the detailed explanation