Hi can we change setInterval to setTimeout function, it is working fine I want to know can it is done with setTimeout
<head>
<script type="text/javascript">
$(function() {
var current = $('#counter').text();
var endvalue = 50
$('a').click(function() {
setInterval(function() {
if (current === endvalue) {
} else {
current++;
$('#counter').text(current)
}
}, 50)
})
})
</script>
</head>
<body>
<div id="counter">0</div>
<a href="#">Click</a>
</body>