posted on Monday, August 22, 2005 5:58 AM
by
Jonathan Hodgson
Useful tip to view the current HTML DOM content of a DHTML page
From an old Web Team talking column; when you are adding and changing HTML DOM content client-side via javascript/DHTML you can't view the current page source.
Selecting 'View Source' only gives you the content as it was when the page loaded and not what's currently in memory/rendered in the browser.
This little trick allows you to view the current HTML, paste it in the address bar:
'<xmp>'+document.documentElement.outerHTML+'</xmp>';
(Note: You need to put the word 'java script:' before the line above. Also remove the space between java and script, I had to have it so Community Server didn't block the post)
It's so useful when debugging AJAX code.