Sean wrote: > Oh, I just tried it and actually you're right! Bummer. It worked in > the code I was using, anyway ;-) > > That behavior actually doesn't make much sense to me; it doesn't seem > like, in practive, you'd ever have immediate siblings that could be > some class (or whatever) that you don't expect. Selecting the next > matching element makes more sense. >
Actually, it does make sense. I have a similar piece of code using fieldset, legends and divs, like so: <fieldset><legend>[ Results ]</legend><div id="wcResult"></div></ fieldset> <fieldset><legend>[ Error ]</legend><div id="wcError"></div></ fieldset> <fieldset><legend>[ Log ]</legend><div id="wcLog"></div></fieldset> and I wanted to animate (fadein/out, slideUp/Down) when the user clicked the field set legend title, to show/hide the next element <div> container. I too got into the thinking like you did but I wasn't sure yet what were "selectors" jQuery results. With the help of Joan, I came up with idiom: $('legend').click( function() { $(this).next().slideToggle('medium',function(){}); }); I forget, but my original code was similar in concept to what you had. I think I had tried this: $('legend').next().slideToggle('medium',function(){}); $('legend div').slideToggle('medium',function(){}); and that isn't correct for what i wanted. It makes perfect sense once you get a good handle on selectors and what are jQuery results. From there, I was able to correct other similar incorrect thinkings where I was using lumping multiple filters into selector search criteria. -- HLS