Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find class inside class with jQuery selectors

I'm trying to do something like the following in jQuery

$('.container').siblings('.outerClass > .innerClass')

where I'm looking for:

<div class="container"></div>

<div class="outerClass">
    <div class="innerClass">
        find me!
    </div>
</div>

I can't get the syntax right.

like image 303
fearofawhackplanet Avatar asked Jan 22 '23 19:01

fearofawhackplanet


1 Answers

And another one (but this should work) (assuming you want to get the element with class innerClass):

$('.container').siblings('.outerClass').children('.innerClass')
like image 110
Felix Kling Avatar answered Feb 08 '23 20:02

Felix Kling