Web/API/WindowOrWorkerGlobalScope/clearInterval
The clearInterval()
method of the WindowOrWorkerGlobalScope
mixin cancels a timed, repeating action which was previously established by a call to setInterval()
.
Syntax
scope.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 by setInterval()
and setTimeout()
are shared, which means you can technically use clearInterval()
and clearTimeout()
interchangeably. However, for clarity, you should avoid doing so.
Return value
Example
See the setInterval()
examples.
Specifications
Specification | Status | Comment |
HTML Living StandardThe definition of 'WindowOrWorkerGlobalScope.clearInterval()' in that specification. | Living Standard | Method moved to the WindowOrWorkerGlobalScope mixin in the latest spec.
|
HTML Living StandardThe definition of 'clearInterval()' in that specification. | Living Standard |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
clearInterval
|
Chrome
Full support 4 |
Edge
Full support 12 |
Firefox Full support 1 Full support 1 Full support 52 Notes' |
IE Full support 4 Full support 4 Notes' From Internet Explorer 4 through 8, |
Opera
Full support 4 |
Safari
Full support 4 |
WebView Android
Full support 1 |
Chrome Android
Full support 18 |
Firefox Android Full support 4 Full support 4 Full support 52 Notes' |
Opera Android
Full support 10.1 |
Safari iOS
Full support 1 |
Samsung Internet Android
Full support 1.0 |
Legend
- Full support
- Full support
- See implementation notes.'
- See implementation notes.
See also
- JavaScript timers
WindowOrWorkerGlobalScope.setTimeout
WindowOrWorkerGlobalScope.setInterval
WindowOrWorkerGlobalScope.clearTimeout
Window.requestAnimationFrame
- Daemons management
WindowOrWorkerGlobalScope.clearInterval() by Mozilla Contributors is licensed under CC-BY-SA 2.5.