<div id="time"></div> <script> var num=1; var timerId = setInterval(function() { var test = document.getElementById('time'); test.innerHTML = num; num++; }, 1000); </script>