Calculate value between <h> using jquery

Asked

Viewed 80 times

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!

  • 2

    and why not calculate in PHP (without the round) and plays with echo in such input?

  • user will inputar how much they want to spend, n have this information before

  • php returns the product value. User puts how much they want to spend and jquery returns the division of these two.

  • 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.

  • Huuummmm got it, I’ll try. Grateful!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.