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é
  • 69,329
  • 26
  • 129
  • 166
Alvin
  • 8,219
  • 25
  • 96
  • 177

0 Answers0