Value

A string containing the ID, or an empty string.

Examples

In the following example the value of id is printed to the console.

js
const video = document.querySelector("video");
const track = video.addTextTrack("captions", "Captions", "en");
track.mode = "showing";
console.log(track.id);

Specifications

Specification
Product help
  • Instance properties
    1. inBandMetadataTrackDispatchType
    2. mode
    3. cuechange
  • Inheritance
    1. TextTrackList
    2. VTTRegion
  • ","source":{"folder":"en-us/web/api/texttrack/id","github_url":"https://github.com/mdn/content/blob/main/files/en-us/web/api/texttrack/id/index.md","last_commit_url":"https://github.com/mdn/content/commit/0c8a320b035cf625c1df67713a94ead2e7f3aec6","filename":"index.md"},"summary":"The id read-only property of the TextTrack interface returns the ID of the track if it has one.","title":"TextTrack: id property","toc":[{"text":"Value","id":"value"},{"text":"Examples","id":"examples"},{"text":"Specifications","id":"specifications"},{"text":"Browser compatibility","id":"browser_compatibility"}],"baseline":{"baseline":"high","baseline_low_date":"2015-07-29","baseline_high_date":"2018-01-29","support":{"chrome":"23","chrome_android":"25","edge":"12","firefox":"31","firefox_android":"31","safari":"6","safari_ios":"6"}},"browserCompat":["api.TextTrack.id"],"pageType":"web-api-instance-property"}}

    Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

    Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant