I have a div with a integer content in it.
<div class="count">12,747,822</div>
I want to increase the content of it by a random number between 2 to 5 every second. Here is what I've tried so far
<script type="text/javascript">
function randomIntFromInterval(min,max) {
return Math.floor(Math.random()*(max-min+1)+min);
}
$(document).ready(function(){
$('.count').html(function(i, val) { return +val+randomIntFromInterval(2,5) });
});
</script>
For some reason this creates a blank div. How should I approach this?