This code selects an element with an ID of "myDivId". Since IDs are unique, this expression always selects either zero or one elements depending upon whether or not an element with the specified ID exists.
If you have a variable containing a DOM element, and want to select elements related to that DOM element, simply wrap it in a jQuery object.
.hasClass() (added in version 1.2) handles this common use case: