I wanted to format a value for all the loop, but only the first one is formated:
each value in values
span#amount #{amount}
<script src="//cdnjs.cloudflare.com/ajax/libs/accounting.js/0.3.2/accounting.min.js"></script>
<script>
$(function () {
function money(value) {
return accounting.formatMoney(value, "$");
}
$("#amount").each(function(){
var val = $(this).text();
$(this).text(money(val));
});
How can I do it?