Here is a simple example and explanation of finding and replacing a html element using jquery

syntax:

$(selector).replaceWith(content,function(index))

simple example:

 $("div.replacehere").replaceWith("<H1>The new content</H1>");

replace all divs assosiated with the class .replacehere with the html content:

<H1>The new content</H1>