1
I have a table where will be calculated Quantity x Price in javascript. Following the rule of decimals.
At the moment I’m using the basic function, but it only works if you put integers or with "." separating(15.50). By separating by 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>
<span id="cpqtde">10</span><br>
<b>Valor:</b> <input id="cpvalor" onblur="calcular()" type="text"><br>
<b>Resultado:</b>
<div id="cpliqu"></div>
Put the necessary code to simulate the problem. What "the basic function"?
– Victor Stafusa