Question

I'm about to design a webshop, build upon the Big Cartel webshop system. The nearest currency they use is Euro, but I want Danish Kroner (DKK), which is 7.5 of Euro.

How can I multiply the number within a div.price?

I've found "jQuery Calculate"-plugin, but I can't figure out how it works.

Plugin site: http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm

Thank you in advance...

Was it helpful?

Solution

$('div.price').text(function(i,v) {
    return Math.round(parseInt(v * 100, 10) * 7.5) / 100;
});

Live demo: http://jsfiddle.net/tbL5r/

OTHER TIPS

$("div.price").each(function(){
 $(this).text(parseFloat($(this).text()) * 7.5);
});

But you really shouldn't be doing that with javascript.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top