> > > One advantage to doing this > > > > $("#Results").html("Some Text").show(); > > > > over this > > > > $("#Results").html("Some Text"); > > > $("#Results").show(); > > > > would be that the script doesn't have to retrieve that wrapped set a > > > second time
That's a good point. In this case, chaining would reduce overhead. > > A chainable method, in jQuery, is written: > > > $.fn.newMethod = function() { > > // Function body... > > return $(this); > > } > > > As you can see, all that's happening is "this" is being converted to a > > jQuery object (defined by jQuery and its alias "$") and returned. > Just a quick clarification on this. The this keyword within the "newMethod" > plugin you just made is already the jQuery object. All you need to do is > return this; So if I understand this correctly, essentially the line is execute from left to right and returns the current object after each method completes? For Example: Obj.method1().method2().method3() This would do the following: 1) Calls method 1 for the orignal Obj 2) Calls method 2 for the obj that is returned from method 1 3) Calls method 3 for the obj returned from method 2 4) etc... Is this correct?