I am showing prices in span class want to add all the prices.To do that I have to remove the currency(which is dynamic).
data will be
<div class="js-price-cell">
<span class="js-price">$280.00</span>
</div>
<div class="js-price-cell">
<span class="js-price">$280.00</span>
</div>
I tried with
$form.find('.js-price-cell').each(function () {
let priceText= $(this).find('.js-price').text();
var itemTotal= parseFloat(priceText.replace(/[^0-9]/gi, ''));
totalAmt += itemTotal;
});
Instead of 560.00. It is giving as 56000. Seems like even the .
is getting replaced.