let's say I have a markup like this:
<div id="foo">
...
<span id="moo">
...
</span>
...
</div>
and I want to select #moo.
why $('#foo').find('span')
works, but $('span', $('#foo'));
doesn't ?
let's say I have a markup like this:
<div id="foo">
...
<span id="moo">
...
</span>
...
</div>
and I want to select #moo.
why $('#foo').find('span')
works, but $('span', $('#foo'));
doesn't ?
Have a look here -- to query a sub-element of an element:
$(document.getElementById('parentid')).find('div#' + divID + ' span.child');