Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Run the Same Function at Regular Intervals w/JavaScript</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
</head>
<body>
<div>
    <p id="para">2</p>
</div>
Demo created by     
    <a href="http://www.devcurry.com" target="_blank">DevCurry.com</a>
</body>
</html>
 
        var cnt = 0;
        setInterval(printDuration('para'), 3000);
        function printDuration(id) {
            cnt += 1;
            $('#para').html(cnt);
        }
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers