Hey Tiago,

This will work:

$(document).ready(function() {
        $("a").click(function() {
            $(".arrow", this).addClass("testing");
        });
    });

it adds a click event to your a tags.  When a a tag is clicked on it finds
the .arrow class within the a tag context and adds the class testing to it.

Ralph

On Thu, Apr 9, 2009 at 11:02 PM, Tiago <tiago...@gmail.com> wrote:

>
> I'm new to jQuery and I'm trying to solve this little problem here.
>
> Imagine that I have the following code:
>
> <ul class="pageitem">
>
> <li class="menu">
> <a href="#music"><span class="name">Music list</span><span
> class="arrow"></span></a>
> </li>
>
> <li class="menu">
> <a href="#album"><span class="name">Album list</span><span
> class="arrow"></span></a>
> </li>
>
> <li class="menu">
> <a href="#song"><span class="name">Song list</span><span
> class="arrow"></span></a>
> </li>
>
> </ul>
>
> So now when I click one of the links I want to be able to change the
> class of the span that contains the arrow class.
>
> How can I know which link was clicked so that I can change the correct
> class and not all of them?
>
> Some like this should change the class of every link on the list
> correct (sorry, I can't try this right now)?
>
>  $(document).ready(function() {
>   $(".pageitem > li > a > span.arrow").addClass("testing");
>  });
>
> Thanks for your help
>
> Tiago
>

Reply via email to