jQuery provides the very useful method replaceWith()
to replace the HTML contents of an element with new content specified as a markup string. The following video tutorial shows both basic and advanced implementations and use cases of this feature. I find more useful for beginners to watch video tutorials instead of reading code. smile