El Magnifico: > Hi, > > Although I figured out the part to add/remove class to an element: > > $("li.x").click(function(){ > var $this = $(this); > if( $this.is('.xshown') ) { > $this.removeClass('xshown'); > $this.addClass('xhidden'); > } > else { > $this.removeClass('xhidden'); > $this.addClass('xshown'); > } > return false; > });
Hi :) the above code could be done much shorter (jQuery way): $("li.x").click(function(){ $("li.x").slideToggle(); }); say that you want a Slide effect. > ...now I just need to know how I can remove the class from say x click > on y or z instead of having to click again on x to remove the class? > > Many Thanks. see if this demo helps :) www.andreavarnier.com/XYZ.html just my two cents...