Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

HTML | DOM Track srclang property

  • Last Updated : 10 Apr, 2019

The DOM track srclang property is used to set or return the value of the srclang attribute which shows the language of the text track.

Note: srclang attribute is required with kind = “subtitles”

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.


  • It is used to return the default property.
  • It is also used to set the default property.
    trackObject.srclang = language_code


  • language_code: It is used to specify the language of the text track. It is a two-letter code.

Return Value: It returns language code of the track in the form of string.


        body {
            text-align: center;
        h1 {
            color: green;
    <h2>Track srclang Property</h2>
    <video width="100" 
        <track src=
            <source id="myTrack" 
    <p>Click the button to get
      the language of the track.</p>
    <button onclick="myFunction()">
        Get srclang
    <p id="gfg"></p>
    <!-- Script to get srclang property -->
        function myFunction() {
            var x = 
              "gfg").innerHTML = x.srclang;

Before clicking on the button:

After clicking on the button:

Supported Browsers:

  • Google Chrome
  • Internet Explorer 10.0+
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!