Track default Attribute
Example
Get the default state of the track:
var x = document.getElementById("myTrack").default;
x output result:
false
Definition and Usage
The default attribute is used to set or return the default state of the track.
This attribute reflects the <track> default attribute.
If the default attribute is used, it specifies that the track should be used if the user has not selected another track.
Note: There cannot be more than one track element with the default attribute per media element.
Browser Support
Internet Explorer, Opera, and Chrome support the srclang attribute.
Note: Firefox, Safari, or Internet Explorer 9 and earlier versions do not support the srclang attribute.
Syntax
Return the default attribute:
Set the default attribute:
Attribute Values
| Value | Description |
|---|---|
| true/false | The default state of the track. true - Track is enabled. false - Default. Track is disabled. |
Technical Details
| Return Value: | Boolean, indicating the default state of the track. | | --- | --- |
More Examples
Example
Set the default state of the track:
document.getElementById("myTrack").default = true;
Related Pages
HTML Reference: HTML <track> default Attribute