Replace elements within html string

This version: use different mechanism to obtain outerHTML

CSS

article.results {
    display:inline-block;
    word-wrap:break-word;
    word-break:break-all;
    width:100%;
    border:1px solid Black;
}
article.results:first-of-type pre:before { 
    color:White;
    background-color:Black;
    font-weight:bold;
    content: "BEFORE: ";
}
article.results:last-of-type pre:before {
    color:White;
    background-color:Black;
    font-weight:bold;
    content: "AFTER: ";
}

JavaScript

$(document).ready(function(){
    var editorhtml = editor.get_html; //get RadEditor html
    var $editor = $(editorhtml);

    showit(editorhtml); //show BEFORE
    $editor.find("form:has(input[type=submit])").replaceWith("<form 123>");
    
    //editorhtml = $editor[0].outerHTML;
    editorhtml = $("<div>").append($editor).html();
    
    showit(editorhtml); //show AFTER
});



//HELPER CLASSES FOR DEMONSTRATION ONLY....

//simulate RadEditor...
var editor = {
    get_html: function(bool) {
        //return bool == true ? '<!-- Begin MailChimp Signup Form -->\n<link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css">\n<style type="text/css">\n#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }\n/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.\nWe recommend moving this block and the preceding CSS link to the HEAD of your HTML file. */\n</style>\n<div id="mc_embed_signup">\n<form action="http://contouronline.us5.list-manage.com/subscribe/post?u=377323111f372da3befc141c1&amp;id=1571fb5b38" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>\n<label for="mce-EMAIL">Subscribe to our mailing list</label>\n<input type="email" value="" name="EMAIL" class="email" id="mce-EMAIL" placeholder="email address" required>\n<div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>\n</form>\n</div>\n\n<!--End mc_embed_signup-->' : '';
        return bool == true ? '<!-- Begin MailChimp Signup Form --><link href="http://cdn-images.mailchimp.com/embedcode/slim-081711.css" rel="stylesheet" type="text/css"><style type="text/css">#mc_embed_signup{background:#fff; clear:left; font:14px Helvetica,Arial,sans-serif; }/* Add your own MailChimp form style overrides in your site stylesheet or in this style block.We recommend...