Very minor point, but since you only need to end() where you want to restore, and subsequently do something with, the original set of elements, the following is also valid...
$("div.section") .find("dt") .addClass("section") .click(function(){ $(this).next().toggle(); }) .end() .find("dd") .hide() .filter(":first") .show(); John Resig wrote: > > > ;-) No problem. I love .end(). > > Although, it should be noted that this snippet: > .onclick() > .next().toggle().end() > .end() > > does not work - .onclick() doesn't exist (yet). That's something else > that I'm working on so that you won't need to write all those annoying > function(){ ... } anymore. We'll see if I can end up doing it in a way > that doesn't cause a big complexity hit. > > So yeah, for right now this is completely valid: > > $("div.section") > .find("dt") > .addClass("section") > .click(function(){ > $(this).next().toggle().end() > }) > .end() > .find("dd") > .hide() > .filter(":first") > .show() > .end() > .end(); > > --John > > On 8/23/07, SeViR <[EMAIL PROTECTED]> wrote: >> >> Hi all, >> >> recently I have read the slides published by John Resig about his >> first Google Tech Talk: >> http://ejohn.org/blog/building-a-javascript-library/ >> >> In the slide number 50 there is a little example code: >> >> $("div.section") >> .find("dt") >> .addClass("section") >> .onclick() >> .next().toogle().end() >> .end() >> .end() >> .find("dd") >> .hide() >> .filter(":first") >> .show() >> .end() >> .end(); >> >> In a first moment, I thought: "ok, wait a moment, I need read this more >> slow". And later, >> I opened my mouth, and said wooowww!!!, Can I do that with jQuery?? >> >> This is the first example of end() method that I can see and, now, I see >> the power of the end() method. >> >> Thanks John and the jQuery team for open our eyes with each JavaScript >> experience ;-) >> >> -- >> Best Regards, >> José Francisco Rives Lirola <sevir1ATgmail.com> >> >> SeViR CW · Computer Design >> http://www.sevir.org >> >> Murcia - Spain >> >> > > -- View this message in context: http://www.nabble.com/end%28%29%2C-this-bug-unknown-tf4315861s15494.html#a12289057 Sent from the JQuery mailing list archive at Nabble.com.