Link to home
Create AccountLog in
Avatar of zumpoof
zumpoof

asked on

Getting a DHTML node as an html string

I've created a 'div' using DHTML. Is it possible to see what it looks like as a string of HTML. So something like this:

var d=document.createElement('DIV');
d.style.border='1px solid';
d.innerHTML='Hi there';

Converted into:

'<DIV STYLE="border:1px solid">Hi there</DIV>'
Avatar of jplevyak
jplevyak

There is an outerHTML property that would return the full HTML as a string but this is only supported in IE. However, there was already a post on this site with this issue where some experts have provided workarounds.

How to get outerHTML in IE and Mozilla (Netscape)
https://www.experts-exchange.com/questions/21221807/How-to-get-outerHTML-in-IE-and-Mozilla-Netscape.html
ASKER CERTIFIED SOLUTION
Avatar of Michel Plungjan
Michel Plungjan
Flag of Denmark image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer