It looks like JQuery does the search in the current document when using a selector.
JQuery
document
How to search for an element only inside a div
div
$('div-selector').find('the selector-you-are-looking-for');