Hi, try this: $('#eventlist a.boldFont').next('a').trigger('click'); $('#eventlist a.boldFont').prev('a').trigger('click');
-- Bohdan Ganicky On Jan 31, 4:26 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hallo, > > I am quite new to Jquery and so please forgive me if my problem sounds > dumb ;) > > HTML: > > <div id="eventlist"> > <img src=".."/><a href="#">One</a><br/> > <img src=".."/><a href="#">Two</a><br/> > <img src=".."/><a href="#">Three</a><br/> > <-------------------------- > > <img src=".."/><a href="#" class=".boldFont">Four</a><br/> > <img src=".."/><a href="#">Five</a><br/> > <-------------------------- > > <img src=".."/><a href="#">Six</a> > </div> > > Problem: > I have to access the anchor above the anchor wih class "boldFont" > and the anchor below the anchor with class ".boldFont".I tried using > the following statements, it worked partially, but i definitely would > like to find a clear n neat solution. > > My code: > $ > ("#eventlist").find("a.boldFont").next().next().next().trigger('click'); > $ > ("#eventlist").find("a.boldFont").prev().prev().prev().trigger('click'); > > For now, it may work since there are only three to four elements > between the anchor. But, if there are N-elements, icannot just go on > writing "next()" !!???!