I'm looking for the shortest/easiest way to achieve this.
var savings = <?php echo $list_price ?> - discount_price;
savings: 1.00
$list_price: '$10.00';
discount_price: '$9.00';
Cheers.
I'm looking for the shortest/easiest way to achieve this.
var savings = <?php echo $list_price ?> - discount_price;
savings: 1.00
$list_price: '$10.00';
discount_price: '$9.00';
Cheers.
Not sure what you're asking here - could you post an example of what you want to achieve?
isnt currency by default represented as a "decimal" (of sorts)
$1.00 = 1.00
0.50c = 0.5
Maybe this is the answer?
var savings = parseFloat(<?php echo $list_price ?>) - discount_price;
var savings = parseFloat('<?php echo $list_price ?>'.substr(1)) -
parseFloat(discount_price.substr(1));
This parses the string as a number, skipping the first characters (dollar).