WindowTimers.clearInterval()
Cancels a timed, repeating action which was previously established by a call to setInterval()
.
Syntax
JavaScript
Copy Code
window.clearInterval(<var>intervalID</var>)
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()
example.
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of 'clearInterval()' in that specification. |
Living Standard |
See also
- JavaScript timers
WindowTimers.setTimeout
WindowTimers.setInterval
WindowTimers.clearTimeout
window.requestAnimationFrame
- Daemons management
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/windowtimers/clearinterval