I am creating a in browser HTML editor. I am using the syntax highlighter called Code Mirror which is very good.
My setup is an iframe that holds a view of the page
You can do it all on one line with jquery
$("iframe").contents().find('html').html("Your new HTML");
See working demo here http://jsfiddle.net/dWpvf/972/
Replace "iframe" with "#render" for your example. I left in "iframe" so that other users can reference the answer.