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