how to print entire HTML element in JavaScript?
        Posted  
        
            by celicni
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by celicni
        
        
        
        Published on 2010-04-13T15:49:38Z
        Indexed on 
            2010/04/13
            15:52 UTC
        
        
        Read the original article
        Hit count: 252
        
JavaScript
I want to print the entire element including tag name, attribute name/value pairs and innerHTML. How can I do it in JavaScript (jQuery)?
for example:
var elArr = document.getElementsByTagName('link');
alert(elArr[0].printEntireElement());
//expected output might be 
<link href="/css/common.css" rel="stylesheet" type="text/css">`
Note that for link element outerHTML is not defined!
© Stack Overflow or respective owner