First put on the element that wraps the div in the question, put the id attribute on the element, and then use getElementById on it: after you have the element, just do "e.innerHTML" to extract the HTML.
<div><span><b>This is in bold</b></span></div>
=> <div id="wrap"><div><span><b>This is in bold</b></span></div></div>
and then:
var e=document.getElementById("wrap"); var content=e.innerHTML;
Note that outerHTML not compatible with multiple browsers.
jldupont Nov 19 '09 at 14:03 2009-11-19 14:03
source share