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