6
I searched the Sopt and I couldn’t find what I wanted Suppose I have one button and, when carrying out a click, he alter the value of some div or input. The initial value is 1, and to the click on, change to 10.
I wish that transition were it not for direct. I wish the numbers were growing up, of 1 at the 10 (Ex: 1,2,3,4,5,6,7,8,9 e, finalmente 10). I thought I’d do with setTnterval and a loop, but I couldn’t think of the solution itself.
I have a preference for jQuery.
I will leave an excerpt to help. Thanks for your attention.
$("#alterarValor").click(function(){
$("#numero").text("10");
});
$("#voltarValor").click(function(){
$("#numero").text("1");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="numero">1</div>
<input type="button" id="alterarValor" value="Alterar valor" />
<input type="button" id="voltarValor" value="Resetar" />
Perfect. Exactly what I wanted. Thank you!
– Victor Eyer