Skip to content

Instantly share code, notes, and snippets.

@iahu
Created October 29, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iahu/fd5ad11698a22e7fe401 to your computer and use it in GitHub Desktop.
Save iahu/fd5ad11698a22e7fe401 to your computer and use it in GitHub Desktop.
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