jQuery - Building object arrays with html5 data attribute selection
<p>I'm using HTML 5 data attributes to key rows of data in a table. I need to iterate the rows and gather the data into an object collection.   I created a class to represent my row data:</p>

<pre><code>function SomeItem(description, finalPrice, percentDiscount) {
    this.Description = description;
    this.FinalPrice = finalPrice;
    this.PercentDiscount = percentDiscount;
}
</code></pre>

<p>An event fires which triggers the collection of this data.</p>

<pre><code>$.each($('.ItemPriceBox'), function () {
            var uniqueid = $(this).data('uniqueid');
            var finalPrice = $(this).val();
        });
</code></pre>

<p>The final piece of data, percentDiscount should be retrieved using the <code>data-uniqueid</code> attribute.  I'm not sure how to do this.</p>

<p>I want...</p>

<pre><code>SomeItem[] items;
$.each($('.ItemPriceBox'), function () {
            var uniqueid = $(this).data('uniqueid');
            var finalPrice = $(this).val();
            var percentDiscount = $('.ItemDiscountBox').where("uniqueid = " + uniqueid);
            items[i] = new SomeItem(uniqueid,finalPrice,percentDiscount);
        });
</code></pre>

<p>How can I solve this?</p>
