I searched SOpt and did not find what I wanted Let's say I have a button and when you click it change the value of some div > or input . The starting value is 1 , and click , change to 10 .
I would like this transition not to be direct . I would like the numbers to be growing , from 1 to 10 Ex: 1,2,3 , 4,5,6,7,8,9 and finally 10 ). I thought about doing with setTnterval and a loop , but I could not think of the solution itself.
I have preference for jQuery.
I'll leave a little bit to help. Thanks in advance 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><divid="numero">1</div>
<input type="button" id="alterarValor" value="Alterar valor" />
<input type="button" id="voltarValor" value="Resetar" />