Hi all,
Whats the wayto modify the "body" of a dom tree like this using javascript:
Original htm: <html> <head></head> <body> blah blah blah </body> </html>
Modified html: <html> <head> </head> <abc> <body> blah blah blad </body> </abc> </html>
That is, I wish to put the whole body node inside another node.
The code I am trying is:
// Create an iframe
var orig_iframe = document.createElement('iframe');
// Copy body's content inside iframe (hopefully!)
orig_iframe.contentDocument.innerHTML= document.body.innerHTML;
// Set document body to null
document.body.innerHTML = '';
// Add iframe to body
document.body.appendChild(orig_iframe);
which doesnt work. Obviously I am missing something!
Thanks!