<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		
	</head>
	<body>
		<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>
		<script type="text/javascript" src="//code.jquery.com/jquery-2.2.0.min.js"></script><script>$(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" + '.');
}</script>
	</body>
</html>