0
I have the following fields:
The student number comes from the database and I’m storing in a hidden field:
<input type="hidden" name="NumAlunos" id="numAlunos" value="<?php echo $visualizar->NumAlunos; ?>" class="form-control">
How would I multiply this field with the unit value and fill in the Revenue field?
<div class="form-group">
<label for="valorDesconto">Valor Unitário:</label>
<div class="input-group">
<div class="input-group-addon" style="background-color: #FAFAFA">
<i class="fa fa-usd"></i>
</div>
<input type="text" name="ValorUnitario" class="form-control pull-right" id="valor" maxlength="10">
</div>
</div>
<div class="form-group">
<label for="valorDesconto">Receita:</label>
<div class="input-group">
<div class="input-group-addon" style="background-color: #FAFAFA">
<i class="fa fa-usd"></i>
</div>
<input type="text" name="ValorReceita" class="form-control pull-right" id="valorReceita" maxlength="10">
</div>
</div>
It depends on how you want it... when you type, when you leave the field, only when there are changes in the field and so on.
– Don't Panic
$("#valorReceita").val( Number($("#NumAlunos").val()) * Number($("#ValorUnitario").val()) )
– Don't Panic
Hi Everson. Will be leaving the Unit Value field.
– user24136