Meds86 Meds86 - 1 year ago 74
jQuery Question

Traverse dom, next, prev

I'm trying to get the next slide element attr

after the active current one.

<ul class="nav">
<li class="active"><a href="#slide01"></a></li>
<li><a href="#slide02"></a></li>
<li><a href="#slide03"></a></li>
<li><a href="#slide04"></a></li>

To get the current one I do

slideActive = $('.nav a').attr('href')
which is good it gives
, however I'm not sure how to get the
of the previous or next

Answer Source

Try this:

1.for selecting the href of the next element


2.for selecting the href of the previous element

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