6
Division less than R$999.00 works correctly. However, more than R$999.00 results in Nan. How to revolve this? I’ve already put a replace and nothing!
$(document).ready(function() {
var demo1 = $('span.ecwid-productBrowser-price-value');
demo1.each(function() {
var valor1 = parseInt(this.innerHTML.replace(',', '.').substr(2) / 3, 10);
$(this).append("<p><i>dividido por 3 é: " + valor1 + "</i></p>")
})
demo1.append();
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<body>
<span class='ecwid-productBrowser-price-value'>R$800,00</span><hr>
<span class='ecwid-productBrowser-price-value'>R$999,00</span><hr>
<span class='ecwid-productBrowser-price-value'>R$1.000,00</span><hr>
<span class='ecwid-productBrowser-price-value'>R$1.200,00</span><hr>
</body>
Related https://answall.com/q/11018/101
– Maniero