 <p>If your project can manage it, it could be better to <a href="http://www.javascriptkit.com/javatutors/dom2.shtml" rel="nofollow">create DOM Elements and append them to the tree</a>. </p> <p>The big problem with efficiency would be that setting <code>.innerHTML</code> property would first remove all the nodes and only then parse the html and append it to the DOM. </p> <p>It's obvious that you should avoid removing and the re-appending identical elements, so if you're sure the <code>"Example"</code> elements would always remain on the page, your way of setting them seems to be a nice optimazation.</p> <p>If you want to optimize it even further, you could parse the html you want to append to nodes and have a function that checks which ones should be appended and which one shouldn't. But be aware that accessing the DOM is costly. Read more about the <a href="http://www.phpied.com/dom-access-optimization/" rel="nofollow">ECMA-DOM bridge</a>.</p> <p><strong>Edit:</strong> In some cases it might be better to let the browser do the html parsing and injecting through <code>innerHTML</code>. It depends on the amount of HTML you're inserting and the amount you're deleting. See <em>@Nelson Menezes</em>'s comments about innerHTML vs. append.</p>