I think you're confused because jQuery accepts self-closing syntax for element creation, this will probably work:
xx.replaceWith( $('<div />') ); On Jul 28, 12:30 pm, "thorasm...@gmail.com" <thorasm...@gmail.com> wrote: > Not sure whether this is a bug, but is is certainly unexpected > behaviour. > > When i try to use replaceWith on a <div /> instead of a <div></div> > (which is correct HTML syntax) it causes, not only the div but all > code after the div to be replaced. > > Please see the code here: > > http://nafai.org/temp/jqueryproblem/ > > I will make a bug report if others also think this is a bug.