How can I reverse the order of HTML DOM elements inside a JavaScript variable?
<p>I need to print out receipts that inserted into my database, and the latest receipt should be on the top of my page. But when I query my database, I store all the data inside a var s, and naturally it will make the data that was inserted earliest on the top of my page, how do I reverse this?</p>

<pre><code>function querySuccess(tx, results){
    if(results.rows.length == 0)
    {
        $("#ReceiptsList").html("&lt;p&gt;You have no receipts captured yet&lt;/p&gt;");
    }
        else
    {
        var s = "";
        for(var i = 0; i&lt;results.rows.length; i++)
        s += "&lt;a href='edit.html?id="+results.rows.item(i).id+"'&gt;&lt;strong&gt;&lt;font size = 3&gt; " + results.rows.item(i).name +"&lt;font&gt;&lt;/strong&gt;" + "&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;font size = 1&gt;Date:" +results.rows.item(i).date +  "&lt;font&gt;&lt;/a&gt; ";
    }
        //I tried s.reverse(); but didn't work, nothing was showed on the page
        $("#ReceiptsList").html(s);
}
</code></pre>
