Easy Tutorial
❮ Jsref Return Prop Element Classlist ❯

Link hreflang Attribute


Definition and Usage

The hreflang attribute specifies the language of the text in the linked document.

Syntax

Setting the hreflang attribute:

Returning the hreflang attribute:


Browser Support

All major browsers support the hreflang attribute.


Example

Display the language of the linked document:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<link id="link1" href="domoarigato.htm" hreflang="ja">
<script>
function displayResult(){
    var x=document.getElementById("link1").hreflang;
    alert(x);
}
</script>
</head>
<body>

<button type="button" onclick="displayResult()">Display the language of the linked document</button>

</body>
</html>

❮ Jsref Return Prop Element Classlist ❯