I have:
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_1">1,000</td>
</tr>
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_2">1,200</td>
</tr>
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_2">1,400</td>
</tr>
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_1">1,600</td>
</tr>
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_1">1,800</td>
</tr>
Each tr represents a product detail row, and in the class of the latest td which is for the product price you can see the product id like product_1 which 1 is the id.
Now in the above example I want to show only 1 price for each product, the cheapest one!
So after doing something on the above, I need to have:
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_1">1,000</td>
</tr>
<tr>
<td>Blah Blah<td>
<td>Blah Blah<td>
<td class="product_2">1,200</td>
</tr>
I assume I need to use jQuery each function like this:
$('td[class^="product_"]').each(function(){
var price = this.text();
// what should happen here?
// here somehow I need to check other trs and see if it's the cheapest one,
// then hidden all others...
})
I appreciate any kind of help