Thanks a lot for the answer, Tim, but it did no work either. It's 5
levels up and there are different tags on the way... I think that's
the reason it's getting that hard. Maybe I'm to focused in the "li"
and the solution is in a different path...

André


On 28 out, 18:59, tpb976 <[EMAIL PROTECTED]> wrote:
> Try removing the ":first" like this:
>
> $("a.confirmar").click(function(){
>    $
> (this).parents("li").next().find("a.apImg").addClass("apImgOn").removeClass("apImg");
>  });
>
> Also, since the methods are chainable, you do not need to traverse to
> the item again.  You can just call .removeClass() right after adding
> the class.
>
> -Tim
>
> On Oct 28, 1:47 pm, André <[EMAIL PROTECTED]> wrote:
>
> > Hello guys,
>
> > I'm in a big trouble trying to create a simple jQuery function, and my
> > boss is "on my neck" asking when I'll be done with this work... I need
> > help!!!
>
> > My HTML is:
>
> >           <li><a class="apImg"></a>
> >               <div>
> >                 <form>
> >                   <ul>
> >                      <li> ... </li>
> >                      <li>... </li>
> >                      <li><a class="confirmar">CONFIRMAR</a></li>
> >                   </ul>
> >                 </form>
> >               </div>
> >             </li>
>
> > When I click "<a class="confirmar"></a>" it should add and remove a
> > class to the "<a class="apImg">", which is located right next to the
> >ancestor"li" on the code above. This piece of code will repeat
> > troughout the HTML that will be generated dynamicaly, and I must ONLY
> >selectthe "<a class="apImg">" above each link and NOT ALL<a> tags
> > inside the code that will carry the same class="apImg".
>
> > I'm trying this:
>
> >    $("a.confirmar").click(function(){
> >    $
> > (this).parents("li:first").next().find("a.apImg").addClass("apImgOn");
> >    $
> > (this).parents("li:first").next().find("a.apImgOn").removeClass("apImg");
> >  });
>
> > But it doesn't work!!!!!!!!!!
>
> > Is there anyone to help me, please?
>
> > André

Reply via email to