I have the following HTML file where #innUsd I enter the amount of what I want to save in Firebase when I press #sendUsd and this amount is reflected in #amountPyp with the amount I had plus the one I sent him.
<section id="checkinn">
<article>
<h3>Ingresos</h3>
<form>
<input type="number" value="0" id="innUsd">
<input type="submit" value="Enviar" id="sendUsd">
</form>
</article>
<article>
<h3>Monto en Paypal</h3>
<span>USD$</span><span id="amountPyp"></span>
</article>
</section>
In my Javascript I have the variable that takes the dollars that Paypal has saved and the button that allows me to make the event I need.
I use the (e) = > as a parameter to use preventDefault () and the theme of the sum of the variables works perfectly together with the update to Firebase.
var montoPyp = document.querySelector('#amountPyp');
btnIngreso.addEventListener('click', (e) => {
e.preventDefault();
let ingreso = parseInt(document.querySelector('#innUsd').value);
let fondo = parseInt(montoPyp.innerText);
let total = ingreso + fondo;
ingreso.value = ''
dbPyp.update({
monto : total
});
})
My problem is that clicking on the 'Submit' button does not set me up empty, poor input.innerText / HTML, income.value, try to do it by converting income into a string, but I have no case.
I would really appreciate the help :)! Greetings and good start to the year ~