Syntax explanation please
<p>I'm trying to understand 2 different lines of code below. My javascript is weak, trying to improve it with jquery (hmmmm)</p>

<p>What I'm trying to use the drag sort plugin from <a href="http://dragsort.codeplex.com/" rel="nofollow">http://dragsort.codeplex.com/</a> specifically I'm using the <a href="http://dragsort.codeplex.com/SourceControl/changeset/view/74794#1025059" rel="nofollow">http://dragsort.codeplex.com/SourceControl/changeset/view/74794#1025059</a> example. </p>

<p>I've gotten to the stage now where I've used this approach</p>

<pre><code>var serialStr = "";
$("#list1 li").each(function(i, elm) { 
    serialStr = (i &gt; 0 ? "|" : "") + $(elm).children().html(); 
});
</code></pre>

<p>The example has the following. </p>

<pre><code>var serialStr = new Array();
$("#list1 li").each(function(i, elm) { 
    serialStr[] = = $(elm).attr("itemId");  
}); 
</code></pre>

<p>The reason I have the first approach is that I was testing everything out and its what they had in the HTML example. I'm now trying to save the state so I've moved onto the php example. </p>

<p>So my question is what is the primary difference going on in the different lines here? My understanding of the first line is that its selecting each child element inside of the li tag on list1 I don't really get the (i > 0 ? "|" : "")  bit. </p>

<p>In the second snipplet from what I understand its selecting every attribute with the itemID assignee in list1 li ? </p>
