Hi Daniele,
Try this: $("a").click(function () { this.className = 'new-class'; $(this).next('div').toggle(); } All sorts of DOM traversing methods can be found here: http://docs.jquery.com/Traversing --Karl _________________ Karl Swedberg www.englishrules.com www.learningjquery.com On Feb 16, 2008, at 5:04 PM, Daniele wrote:
I have some troubles with my project. Here it is the problem: I have an HTML like this <a href="">click</a> <div> xxxx </div> <a href="">click</a> <div> xxxx </div> .... When I click on the link i want to change its class and toggle the <div> below without using any ID. I have no problem changing the link, but I can't find a way to select the FIRST next element. $("a").click(function () { $(this).attr({className: "new-class"}); $(this + " + div").eq(0).toggle(); } I though something like this would work, but it doesnt. How can i select the first next element after my click element? daniele