Can someone tell me how to do a function assigned to a button that takes a number inside the DOM, adds X and replaces the old number with the new one?
I've tried this.
var boton = document.getElementById("boton"); //variable de boton para incrementar valor
var numero = document.getElementById("numero").value; //variable del numero en el DOM
boton.addEventListener("click", boton);
function lvl1cash() {
var result = numero++; //variable con el resultado
document.getElementById("numero").innerHTML = result; //Muestra resultado de la funcion en DOM
}
<h3 id="numero">1</h3>
<button id="boton" value="Boton" onclick="boton">SUMAR</button>