Window clearTimeout() Method - Javascript Browser Object Model

Javascript examples for Browser Object Model:Window clearTimeout


The clearTimeout() method clears a timer set with the setTimeout() method.

Parameter Values

id_of_settimeout Required. The ID value of the timer returned by the setTimeout() method

Return Value:

No return value

The following code shows how to Prevent the function set with the setTimeout() to execute:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<button onclick="myFunction()">Test</button>
<button onclick="myStopFunction()">Stop the alert</button>

var myVar;//from   w w  w. j a va 2 s .c  o m

function myFunction() {
    myVar = setTimeout(function(){ console.log("Hello"); }, 3000);

function myStopFunction() {


Related Tutorials