// This will keep track of the timer var timer; $("#startlink").click(function(){ timer = window.setInterval(function(){ $("#dots").append(". "); }, 500); }); $("#stoplink").click(function(){ window.clearInterval(timer); });
<a id="startlink" href="#">start</a> <a id="stoplink" href="#">stop</a> <div id="dots">. </div>
#dots{ font-family: monospace; font-size: 20px; }