yigitozmen yigitozmen - 4 years ago 170
Javascript Question

Jquery, how to get value of the next of the next element

i want to get value of the second element after the input.
Here is the code:

<div class="col-md-12 nopadding lines">
<label><input type="checkbox"> {{$e->title}}
<small class="desc">/ @if($i->ctype==0) Daily@else Weekly @endif</small>
<small class="price">{{$e->price}} TL</small></label>

This code iterates in foreach. So i have a lot of this block.
I want to reach price value in success function of ajax.
How can i get this value?

Answer Source

You could either chain two .next() methods:


or you could use .nextAll() and .eq() in order to get the second sibling:


Of course if you know the second element's class, you can specify that as well:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download