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 select the "<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é