On Wed, Sep 17, 2008 at 6:58 AM, Karl Rudd <[EMAIL PROTECTED]> wrote:
> > Nah, it's not a bug. > > replaceWith( content ) Returns: jQuery > Replaces all matched elements with the specified HTML or DOM elements. > This returns the JQuery element that was just replaced, which has been > removed from the DOM > > ( http://docs.jquery.com/Manipulation ) It may be well documented, but that doesn't mean it can't be a bug. ;) > > It's like doing a remove(), followed by an append(). Like "remove()" > it also "returns" (well keeps in the jQuery collection) the elements > it removes. This is quite a fundamental difference. Since .remove() returns a DOM Element, it's not chainable. Since replaceWith() returns a chainable jQuery object, it's reasonable to expect methods you call on that chain to effect the new element, not your now removed/disconnected element(s). Like many other methods, it could modify the chain. And if you wanted to get back to the previous chain, you could call .end(). My 2c. - Richard