Reputation: 587
I noticed in the jQuery docs that as of 1.4, calling $() with no args just returns an empty set rather than $(document). http://api.jquery.com/jQuery/#returning-empty-set
So, is there no other shorthand for $(document)?
I ask because I can't decide which is uglier if I'm trying to select an element by an ID that I have in a variable: $("#" + myID) or $(document).find(myId).
Thanks.
Upvotes: 1
Views: 131
Reputation: 5265
If you are selecting an element by an ID you should use $("#" + myID)
. $(document).find(myId)
would be wrong.
Upvotes: 3