Created
November 12, 2014 03:53
-
-
Save gasolin/37663c09509d7774e409 to your computer and use it in GitHub Desktop.
print HTML element for debugging, from http://stackoverflow.com/questions/2631019/how-to-print-entire-html-element-in-javascript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.getHTML = function(who){ | |
var txt, ax, el= document.createElement("div"); | |
el.appendChild(who.cloneNode(false)); | |
txt= el.innerHTML; | |
ax= txt.indexOf('>')+1; | |
txt= txt.substring(0, ax)+who.innerHTML+ txt.substring(ax); | |
el= null; | |
return txt.replace(/>/g,'>\n'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment