So I’m trying to use jQuery to select an element like this:
<div>
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
<ul>
</div>
<div>Item to be operated on when the first li is clicked.</div>
<div>Item to be operated on when the second li is clicked.</div>
<div>Item to be operated on when the third li is clicked.</div>
And of course I’m looking to start my jQuery function with
$('ul li')
Is there a way to do this without multiple dom dives? What I essentially need is “next().next().next()” if it didn’t only operate on direct siblings. Assume I can’t move around the markup. Thanks.
In this case you might do :
See the eq function.