0
Good morning, I have the following code:
<section id="four" class="wrapper special">
<div class="inner">
<div class="features" id="Comprando">
<div class="feature">
<h3>Produto1</h3>
<b>R$ <?php echo round($valor1, 3); ?></b>
<input type="text" class="reais">
<input type="text" class="resultado" readonly>
</div>
<div class="feature">
<h3>Produto2</h3>
<b>R$ <?php echo round($valor2, 3); ?></b>
<input type="text" class="reais">
<input type="text" class="resultado" readonly>
</div>
</div>
</div>
</section>
Basically the product value comes from a variable ($value), the staff puts how many reals they want to spend (input class="reals") and the jquery performs a division between the input and the variable, and the result comes out in input class="result". This is every time the person fills in the actual input and for each div, that is, for each product. Anyone who can help, I’d like to thank!
and why not calculate in PHP (without the
round
) and plays with echo in such input?– Guilherme Nascimento
user will inputar how much they want to spend, n have this information before
– Renann Lima
php returns the product value. User puts how much they want to spend and jquery returns the division of these two.
– Renann Lima
Ué, leave the value saved in a non-round Hidden input and no mask, then just take the value of
$('input[name=valor]').val()
and calculate.– Guilherme Nascimento
Huuummmm got it, I’ll try. Grateful!!
– Renann Lima