jQuery selecting deep non id element
How i can select this deep non id element in jQuery ? And I do not want select first or last, just exactly by order (etc 3,4 "menu_transition" e开发者_如何学Pythonlement in order ).
<ul id="menu_container_content">
<li class="menu_item">
<div class="menu_background"></div>
<div class="menu_transition"></div>
<div class="menu_tile"><h2>ABOUT ME</h2></div>
<div class="menu_description">
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In lectus enim, pharetra in gravida quis, vehicula id ante.
Cras mollis, mauris sed fermentum tempus
</div>
</div>
</li>
<li class="menu_delimiter"></li>
<li class="menu_item">
<div class="menu_background"></div>
<div class="menu_transition"></div> <!-- THIS CONCRETE ELEMENT I WANT EDITED -->
<div class="menu_tile"><h2>PROGRAMING</h2></div>
<div class="menu_description">
<div>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
In lectus enim, pharetra in gravida quis, vehicula id ante.
Cras mollis, mauris sed fermentum tempus
</div>
</div>
</li>
</ul>
Without using the eq
selector, but using the eq()
method instead:
$('#menu_container .menu_item').eq(n).children('.menu_transition')
which should avoid the need to concatenate together a string selector with "n" in the middle of it.
You can write
$('#menu_container_content .menu_item:eq(1) .menu_transition')
The :eq()
selector selects the nth matching element (zero-based).
精彩评论