# How to programmatically enable or disable text tracks on Web

This article describes how you can use the TextTrack API to enable or disable subtitles, closed captions or metadata. Implementing this functionality is a common use-case for developers who want to build their own UI to toggle subtitles.

It is advised to disable the text tracks which you do not want to display, in order to avoid issues with overlapping text.

## Usage

Set the [`mode`](https://docs-preview.optiview.dolby.com/pr-863/theoplayer/v11/api-reference/web/interfaces/TextTrack#mode) of a [`TextTrack`](https://docs-preview.optiview.dolby.com/pr-863/theoplayer/v11/api-reference/web/interfaces/TextTrack).

```js
// disable all text tracks
player.textTracks.forEach(function (track) {
  track.mode = 'disabled';
});
// enable a specific text track
player.textTracks[indexOfRequestedTextTrack].mode = 'showing';
```

## Related articles

* [How to dynamically change the visible captions](https://docs-preview.optiview.dolby.com/pr-863/theoplayer/how-to-guides/web/text-tracks/change-visible-captions.md)
* [How to programmatically detect text tracks](https://docs-preview.optiview.dolby.com/pr-863/theoplayer/how-to-guides/web/text-tracks/detect-text-tracks.md)
* [How to build a chromeless UI](https://docs-preview.optiview.dolby.com/pr-863/theoplayer/how-to-guides/web/ui/build-chromeless-ui.md)
