I have a table where Quantity x Price in javascript will be calculated. Following the rule of decimal places.
I'm currently using the basic function, but it works only if I put whole numbers or "." separating (15.50). By separating with a comma, the calculation no longer works.
function calcular() {
var cpqtde = $('#cpqtde').text();
var cpvalor = $('#cpvalor').val();
$('#cpliqu').text(cpqtde * cpvalor);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><b>Quantidade:</b><spanid="cpqtde">10</span><br>
<b>Valor:</b> <input id="cpvalor" onblur="calcular()" type="text"><br>
<b>Resultado:</b>
<div id="cpliqu"></div>