0

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?

Fabrício Matté
  • 67,789
  • 24
  • 124
  • 163
Alvin
  • 7,787
  • 23
  • 77
  • 164

0 Answers0