View Full Version : How can I get the outerHtml of an Element?

26 Mar 2014, 11:38 AM
I see a getHTML method, which gives me the innerHtml, but how can I get the entire element's HMTL?

26 Mar 2014, 12:20 PM
Ext.dom.Element has a dom property that will give you the dom node it represents. You need to convert this to a string. If the browsers you're targeting support (I think all do now but not positive) outerHTML, you can use it directly as in


If for some reason the browser doesn't have outerHTML, you can try the trick of appending a copy of your content to a temporary new code that you create as in http://stackoverflow.com/questions/1750815/get-the-string-representation-of-a-dom-node