How to Start count and Brack timer clearTimeout() in Jquery

Start count and Brack timer clearTimeout() in Jquery,How to Start count and Brack timer clearTimeout() in Jquery
Share it:
Start count and Brack timer clearTimeout() in Jquery


Enable break times in Jquerycountdown timer

In these articles, we will learn How to  Start count and Brack timer clearTimeout() in JqueryEnable break times in Jquerycountdown timer.


<!DOCTYPE html>
<html>
<body>

<button onclick="startCount()">Start count!</button>
<input type="text" id="txt">
<button onclick="stopCount()">Stop count!</button>

<p>
Click on the "Start count!" button above to start the timer. The input field will count forever, starting at 0. Click on the "Stop count!"
<br/> button to stop the counting. Click on the "Start count!" button to start the timer again.
</p>

<script>
var c = 0;
var t;
var timer_is_on = 0;
var myCounter = 0;

function timedCount() {
  document.getElementById("txt").value = c;
  c = c + 1;  
  
  t = setTimeout(timedCount, 1000);
  myCounter = myCounter + 1
   if(myCounter == 100)
    {
     c = 0;
     t;
     timer_is_on = 0;
     myCounter = 0;
    clearTimeout(t);
   timer_is_on = 0;
    }
   
}

function startCount() {
  if (!timer_is_on) {
    timer_is_on = 1;
    timedCount();
  
   
  }
}

function stopCount() {
 c = 0;
 t;
 timer_is_on = 0;
 myCounter = 0;
  clearTimeout(t);
  timer_is_on = 0;
}
</script>

</body>
</html>

OutPut:-

Enable break times in Jquerycountdown timer

Share it:

jQuery

Post A Comment:

0 comments: