Window: clearInterval() method - Web APIs | MDN (original) (raw)

Baseline

Widely available

The clearInterval() method of the Window interface cancels a timed, repeating action which was previously established by a call to setInterval(). If the parameter provided does not identify a previously established action, this method does nothing.

Syntax

clearInterval(intervalID)

Parameters

intervalID

The identifier of the repeated action you want to cancel. This ID was returned by the corresponding call to setInterval().

It's worth noting that the pool of IDs used bysetInterval() andsetTimeout() are shared, which means you can technically use clearInterval() andclearTimeout() interchangeably. However, for clarity, you should avoid doing so.

Return value

Examples

See setInterval() for examples.

Specifications

Specification
HTML # dom-clearinterval-dev

Browser compatibility

See also