JavaScript insertBefore not updating - needs double or treble click
<p>This is driving me nuts, a simple script to swap two nodes in a two node ul:</p>

<pre><code>// Html
&lt;input type="button" onclick="swapItems()" value="Swap Items" /&gt;

//JavaScript
function swapItems() {
    var ul2 = document.getElementById("ul2");
    var first = ul2.firstChild;
    var last = ul2.lastChild;
    ul2.insertBefore(last, first);
}
</code></pre>

<p>It works but I have to either double click or triple click the button to see the changed list.</p>
