don't use replaceWith, use html of element, to replace the contents.