To get the value of the hreflang attribute of a link in JavaScript, use the hreflang property.
Example
You can try to run the following code to get the value of the href attribute of a link.
<!DOCTYPE html> <html> <body> <p><a id="anchorid" hreflang="en-us" href="https://www.qries.com/">Qries</a></p> <script> var myHrefLang = document.getElementById("anchorid").hreflang; document.write("Value of hreflang attribute: "+myHrefLang); </script> </body> </html>