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's like doing a remove(), followed by an append(). Like "remove()" it also "returns" (well keeps in the jQuery collection) the elements it removes. Karl Rudd On Wed, Sep 17, 2008 at 8:35 PM, Richard D. Worth <[EMAIL PROTECTED]> wrote: > This sounds like a bug to me. Better raise it on the jQuery Dev list: > > http://groups.google.com/group/jquery-dev/ > > - Richard > > On Tue, Sep 16, 2008 at 4:58 AM, tchvil <[EMAIL PROTECTED]> wrote: >> >> Hi, >> replaceWith returns the JQuery element that was just replaced. >> >> In the example below: >> $( 'div#old' ).replaceWith( '<div>new</div>' ).html() >> >> It is the html of the old div that is returned. >> Is there another set of commands to get the new one returned? >> >> Thanks, >> tchvil >> >> >> Here is a working example: >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/ >> TR/html4/strict.dtd"> >> <html> >> <head> >> <script type="text/javascript" >> src="http://jqueryjs.googlecode.com/ >> files/jquery-1.2.6.pack.js"></script> >> <title>ReplaceWith Chain</title> >> </head> >> <body> >> <div id="old">old</div> >> <script type="text/javascript"> >> >> alert($('div#old').replaceWith('<div>new</div>').html()); >> </script> >> </body> >> </html> >> > >