You can't just use .prev() or .next() because the links are within list items. Instead, you'll need to do something like this:

$('a.active').parent().prev().find('a')

and this:

$('a.active').parent().next().find('a')

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Dec 27, 2009, at 8:50 PM, Ami wrote:

$('.active').prev()
$('.active').next()

Rate me please if I helped.

On Dec 28, 2:30 am, Toaster <mr.toas...@gmail.com> wrote:
Hello.

Example:

<ul>
      <li><a></li>
      <li><a class="active"></li>
      <li><a></li>
</ul>

How would I be able to get find the next or previous <a> in relation
to the <a class="active">?

I'd appreciate it if anybody could help me out with this. Thanks in
advance.

Reply via email to