HTML | srclang Attribute
The srclang attribute is used to specify the language of the track text. The srclang attribute can be applied on the <track> element:
Note: srclang attribute is required with kind = “subtitles”.
Example: Below is the example of srclang attribute.
<html> <head> </head> <body style="text-align: center"> <h1 style="color: green"> GeeksforGeeks </h1> <h2>HTML srclang Attribute</h2> <video width="100" height="100" controls> <track src= id="myTrack1" kind="subtitles" srclang="en" label="English"> <source id="myTrack" src= type="video/mp4"> </video> <p> Click the button to get the language of the track. </p> <button onclick="myFunction()"> Get srclang </button> <p id="gfg"></p> <!-- Script to get the value of srclang property --> <script> function myFunction() { var x = document.getElementById("myTrack1"); document.getElementById( "gfg").innerHTML = x.srclang; } </script> </body> </html> |
chevron_right
filter_none
Output: Click the button to get the value of srclang attribute:

Supported Browsers:
- Google Chrome 18.0
- Internet Explorer 10.0
- Opera 15.0
- Firefox 31.0
- Safari 6.0
Recommended Posts:
- HTML | <track> srclang Attribute
- HTML | DOM Track srclang property
- HTML | <a> rel Attribute
- HTML | min Attribute
- HTML | <map> name Attribute
- HTML | low Attribute
- HTML | dir Attribute
- HTML | <img> src Attribute
- HTML | for Attribute
- HTML | <li> value Attribute
- HTML | <img> alt Attribute
- HTML | value Attribute
- HTML | <area> alt Attribute
- HTML | <a> target Attribute
- HTML | form Attribute
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



