<table border="1">
	<thead>
		<tr>
			<th>Item</th>
			<th>Price</th>
		</tr>
	</thead>
	<tbody>
		<tr>
			<td>Banana</td>
			<td class ="price">Rp. 50.000</td>
		</tr>
		<tr>
			<td>Apple</td>
			<td class ="price">Rp. 100.500</td>
		</tr>
		<tr>
			<td>Bonteng</td>
			<td class ="price">Rp. 6.250</td>
		</tr>
	</tbody>
	<tfoot>
		<tr>
			<td>Total:</td>
			<td id="sum"></td>
		<tr>
	</tfoot>
</table>
					

					
$(document).ready(function(){
	var sum = 0;
	$('.price').each(function() {
        var value = parseFloat($(this).text().replace(/[^0-9]/g, ''));
		if(!isNaN(value) && value.length != 0) {
			sum += parseFloat(value);
		}
    });
	$('#sum').text(formatDuit(sum));
})

function formatDuit(number, places) {
	number = number || 0;
	places = !isNaN(places = Math.abs(places)) ? places : 2;
	var negative = number < 0 ? "-" : "",
	    i = parseInt(number = Math.abs(+number || 0).toFixed(places), 10) + "",
	    j = (j = i.length) > 3 ? j % 3 : 0;
	return 'Rp.' + negative + (j ? i.substr(0, j) + '.' : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + '.');
}