I have the following HTML:
<div id="mydiv">
<div class="myclass"></div>
</div>
I want to be able to use a selector that selects the inside div, but specific for the mydiv container. How can I achieve this with jQuery?
I have the following HTML:
<div id="mydiv">
<div class="myclass"></div>
</div>
I want to be able to use a selector that selects the inside div, but specific for the mydiv container. How can I achieve this with jQuery?
Try:
$('#mydiv').find('.myclass');
Or:
$('.myclass','#mydiv');
Or:
$('#mydiv .myclass');
References:
Good to learn from the find() documentation:
The .find() and .children() methods are similar, except that the latter only travels a single level down the DOM tree.
Try this
$("#mydiv div.myclass")
You'll do it the same way you would apply a css selector. For instanse you can do
$("#mydiv > .myclass")
or
$("#mydiv .myclass")
The last one will match every myclass inside myDiv, including myclass inside myclass.
try this instead $(".video-divs.focused"). This works if you are looking for video-divs that are focused.