get text from attribute and format it
<p>I have a div elements with <code>data-seat</code> and <code>data-row</code> property:</p>

<pre><code>&lt;div class='selected' data-seat='1' data-row='1'&gt;&lt;/div&gt;
&lt;div class='selected' data-seat='2' data-row='1'&gt;&lt;/div&gt; 
&lt;div class='selected' data-seat='3' data-row='1'&gt;&lt;/div&gt; 
&lt;div class='selected' data-seat='1' data-row='2'&gt;&lt;/div&gt;
&lt;div class='selected' data-seat='2' data-row='2'&gt;&lt;/div&gt;
</code></pre>

<p>I want print friendly message for selected seats:</p>

<pre><code>var  selectedPlaceTextFormated =''; 
$(".selected").each(function () {

        var selectedPlace = $(this);

        selectedPlaceTextFormated += "Row " + selectedPlace.attr("data-row") + " (seat " + selectedPlace.attr("data-seat") + ")\n";
    });
alert(selectedPlaceTextFormated);
</code></pre>

<p>This code works well and shows the following:</p>

<pre><code>Row 1 (seat 1)
Row 1 (seat 2)
Row 1 (seat 3)
Row 2 (seat 1)
Row 2 (seat 2)
</code></pre>

<p>But, I want group seats by row, i.e I want the following:</p>

<pre><code>Row 1(seats: 1,2,3)
Row 2(seats: 1,2)
</code></pre>

<p>also, order by row number. How can I do this?<br>
Thanks. <a href="http://jsfiddle.net/gJFJW/1/" rel="nofollow">DEMO</a></p>
