Favorites

HTML oncuechange Event Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
oncuechange
HTML Event AttributeThis event attribute is supported by all modern browsers.
Updated 22nd November 2026

Description

The oncuechange event attribute is used on the <track> element and runs a script when the active cues of a text track change: when a subtitle, caption or chapter cue starts or stops being displayed during playback of a <video> or <audio> element.

The same event also fires on the track's TextTrack object (track.track.oncuechange). Inside the handler, this.track.activeCues holds the cues that are currently active, so the text can be shown in a custom caption area, used to highlight a transcript, or used to update the page when a new chapter begins.

The event only fires for tracks whose mode is "showing" or "hidden"; a disabled track does not fire it. Set mode to "hidden" to receive the events without the browser drawing the captions itself.

Syntax

<track oncuechange="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE html>
<html>
<head>
<title>oncuechange event</title>
</head>
<body>
<video controls width="320" src="movie.mp4">
<track default kind="captions" srclang="en" src="captions.vtt" oncuechange="showCue(this)">
</video>
<p id="caption"></p>
<script>
function showCue(track) {
var cues = track.track.activeCues;
document.getElementById("caption").textContent = cues.length ? cues[0].text : "";
}
</script>
</body>
</html>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML oncuechange event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.

This event attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee