2
I don’t know if I made myself clear, but in the javascript code below, I want every time I click the button, a sum occurs, but I’m only able to concatenate. Thank you!
function somar(){
document.getElementById("valorSomado").value += 80;
}
<button onclick="somar();">Somar</button>
<input type="text" id="valorSomado">
It worked, thank you very much!
– thismarcoantonio
A cool tip is to use typeof to check the variable type.
– Mauro Alexandre
@Mauroalexandre In this case do not need, because the value field will always be string.
– bfavaretto
@Freneticfx great! If you want you can click and mark the answer as "accept".
– Sergio