Hello,

I have been learning jQuery and have been loving it so far. But can't
figure out how to do the following...

1) Find the <a> inside a <ul> that has an active class.
2) Grab the value from the parent <li> and put it into a variable to
be used elsewhere.

Here is the example markup...

<ul id="carousel">
    <li class="carousel-item" carouselindex="1">
     <a href="/someurl"><img src="/someimg" alt="" /></a>
   </li>
   <li class="carousel-item" carouselindex="2">
     <a class="active" href="/someurl"><img src="/someimg" alt="" /></
a>
   </li>
</ul>

So, in this example, I'd like to return a variable that = 2.

Any help is appreciated. Thanks!

Reply via email to