Javatpoint Logo
Javatpoint Logo

jQuery :lang() selector

The :lang() selector is used to select the elements with the specified language code. It selects the elements whose language value is equal to the supplied language code. This selector can also select the elements whose language value starts with the supplied language immediately followed by a hyphen ("-"). We can use the lang attribute in HTML to determine the language value of the elements.

For example, suppose we are using $("p:lang(en)"), so the selector will only select those paragraph elements whose language value is either en or start with en such as en-us, en-uk, etc., i.e., <p lang = "en"> and <p lang = "en-us">, but it will not select <p lang = "fr"> or any other paragraph element whose language value is different from the supplied language code.

Syntax

This parameter accepts a single parameter language that specifies the language code.

Example

In this example, we are using the :lang() selector to select the paragraph elements whose language code is either en or start with en.

Test it Now

Output

After the execution of the above code, the output will be -

jQuery :lang() selector

After clicking the given button, the output will be -

jQuery :lang() selector





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA