In JavaScript, the animationend event fires when a CSS Animation has completed (MDN). If the animation aborts early (element removed from the DOM, or the animation removed from the element), animationend is not fired. The event object is an AnimationEvent.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Syntax
Listen for animationend. Start with this line.
JavaScript
el.addEventListener("animationend", fn)
Call
What it does
el.addEventListener("animationend", fn)
Primary signature.
Built into the browser. Listen with el.addEventListener("animationend", …) — no import required.
Attach both listeners. Finish and abort are separate outcomes.
Finish path. Let the animation complete → only animationend.
Abort path. Remove the animation mid-run → no animationend (MDN).
Cleanup tip. Use cancel (where supported) when you need abort-side cleanup.
Compatibility
Browser Support
Element animationend is a standard CSS Animations event. MDN marks it Baseline Widely available since December 2019 — safe for everyday use in modern browsers.
✓ Baseline Widely available
Element animationend
Fires when a CSS animation completes — pair with animationcancel when abort cleanup matters.
WideBaseline
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
animationendWidely available
Bottom line: Use animationend for normal finish cleanup. Remember: early abort means no animationend — listen for animationcancel too when needed.
Frequently Asked Questions
It fires when a CSS Animation has completed (MDN). If the animation aborts before completion — for example the element is removed from the DOM or the animation is removed from the element — animationend is not fired.
No. MDN marks Element animationend as Baseline Widely available (since December 2019). It is not Deprecated, Experimental, or Non-standard.
An AnimationEvent. Useful read-only properties include animationName, elapsedTime, and pseudoElement.
Use element.addEventListener("animationend", handler) or set element.onanimationend = handler. Prefer addEventListener when you need multiple handlers or easy removal.
animationend means the animation finished normally. animationcancel means it was aborted early and never reached a normal end — then animationend does not fire for that run.
No. Each completed iteration (except the last) fires animationiteration. After the final iteration finishes, animationend fires once.