X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM lang Property

HTMLElement Object Reference Element Object

Example

Ge the language code of a <p> element:

var x = document.getElementById("myP").lang;

The result of x will be:

en

Try it yourself »


Definition and Usage

The lang property sets or returns the value of the lang attribute of an element.

The lang attribute specifies the language code of the element's content.


Browser Support

Property
lang Yes Yes Yes Yes Yes


Syntax

Return the lang property:

HTMLElementObject.lang

Set the lang property:

HTMLElementObject.lang=language_code

Property Values

Value Description
language_code Specifies the language code for the element's content. Language code reference

Technical Details

Return Value: A String, representing the language of the element's text


Related Pages

HTML reference: HTML lang Attribute


HTMLElement Object Reference Element Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook