1
I have an input number and I would like when the user enters a value he makes an addition sum with a preset value by a variable and shows the result using Innerhtml (because I need modified value within a div:
Example:
<input id="input-currency" required type="number" class="Input Input-currency Input--noSpinner" min="0.00" max="100000" step="500" value="10000" maxlength="7" data-number='{"toFixed":2,"stepfactor":10000}' />
<div class="resultado_1"> somado com: 1.4% </div>
<div class="resultado_2"> somado com: 2.5% </div>
<div class="resultado_3"> somado com: 1.3% </div>
<div class="resultado_4"> somado com: 1.87% </div>
<div class="resultado_5"> somado com: 1.6% </div>
Exactly that Vinicius! Thank you very much! Just one more thing, for me to leave an initial value in Input example: 10,000, I have to create a variable and assign that value to the input?
– Ogait Euqireh
@Ogaiteuqireh you can make this calculation into a function that takes the input value as parameter, and as soon as js loads you call this function passing the input initial value.
– Vinicius Farias