Difference between element.innerHTML and element.outerHTML

By | 2012/11/16

Considering following example:

<ul id="menu">
    <li>Node 1</li>
    <li>Node 2</li>
</ul>

and following code:

var el = document.getElementById("menu");

el.innerHTML returns:

<li>Node 1</li>
<li>Node 2</li>

el.outerHTML returns:

<ul id="menu">
    <li>Node 1</li>
    <li>Node 2</li>
</ul>

Suppored in all browsers.