Jquery Clearinterval Example - Jquery

How to stop or clear interval time in jquery function?

Snippet Code

Rate this page :
  [ 0 votes]

The jquery clearinterval code is used to stop the setInterval function. This is done through clearInterval() method.

<script type='text/javascript'> var mytime = setInterval(function(){ settime() }, 100); function settime() { var d = new Date(); var t = d.toLocaleTimeString(); $("#demo").html(t); } function stoptime(){ clearInterval(mytime); } </script> <div id='demo'></div> <input type='button' id='stop' value='StopTime' onclick='stoptime()'>


Ask Questions

Ask Question