简体   繁体   中英

jQuery: Multiply a number with 7.5

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...

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

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM