Thus, when executing an event in the plot, it already calculates the value per plot.
<input type="text" placeholder="Valor Total" id="total">
<input type="text" placeholder="Quantidade parcela" id="parcela">
<input type="text" placeholder="Valor por Parcela" id="valorParcela">
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
$('#parcela').change(function(){
var valor = parseFloat($('#total').val());
var parcela = parseInt($('#parcela').val());
var totalParcela = valor / parcela;
$('#valorParcela').val(totalParcela);
});
I’m trying to make this way
$('#portion').change(function(){
 var valor = parseFloat($('#total').val())
 var parcela = parseInt($('#portion').val())
 var total = valor / parcela
 $('#moneypar').text(total)
});
– Jean Prado
@Jeanprado ok, if you prefer to use jQuery everything ok. You got it working?
– Sergio
@Jeanprado here in Sweden where I live is already late. I take a look here later. But I think you better use the event
input
. Thechange
fire only after leaving the focus of the element.– Sergio
yes I used the example of Lucas
– Jean Prado
I’m grateful, the change is too slow to calculate.
– Jean Prado