Link to home
Start Free TrialLog in
Avatar of dlearman1
dlearman1Flag for United States of America

asked on

What is the correct jQuery usage ( document ).ready... or ('document').ready...?

What is the correct jQuery usage ( document ).ready... or ('document').ready...?  I've always used ( document ).ready, but I'm working with a developer module that uses ('document').ready; and it seems to work. Are the forms interchangeable?
Avatar of leakim971
leakim971
Flag of Guadeloupe image

there's no <document></document> in the page so we use $(document)
there's no <window></window> so we use $(window)
window.document : https://developer.mozilla.org/en-US/docs/Web/API/Window/document
window.window : https://developer.mozilla.org/en-US/docs/Web/API/Window/window

note : window. is used to access global objects

check this :

User generated image
Avatar of dlearman1

ASKER

I gather you're telling me that $(document) is correct, which is fine. The question remains "why does ('document') also work with no issues?
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial