Skip to content

Instantly share code, notes, and snippets.

@iahu
Created Oct 29, 2015
Embed
What would you like to do?
element.outerHTML
var p = document.getElementsByTagName("p")[0];
console.log(p.nodeName); // shows: "P"
p.outerHTML = "<div>This div replaced a paragraph.</div>";
console.log(p.nodeName); // still "P";
/*
Feature | Firefox (Gecko) | Chrome | Internet Explorer | Opera Safari
Basic support | 11 (11) | 0.2 | 4.0 | 7 1.3
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment