:lang() selectorThe :lang() selector selects all elements(and any of their descendant) of the specified language. It matches elements that takes a whole word a value or immediately followed by a hyphen(-).
For example, the selector $("div:lang(en)") will match <div lang="en"> and <div lang="en-us"> (and any of their descendant <div>s), but not <div lang="fr">
:lang() selector Syntax$(':lang(language)')
:lang() selector ExamplesIn below example,we will set a different background color according to the language of the element.
Please note that the elements [<h2>France</h2>,<p>la france</p>] inherit language from their parent element. So the selector $(':lang(fr)') will match these two elements.
<h2 lang="en-us">USA</h2>
<p lang="en">contents</p>
<div lang="fr">
<h2>France</h2>
<p>la france</p>
</div>
<script>
$("h2:lang(en)").css("background",'aqua');
$("p:lang(en)").css("background",'coral');
$("h2:lang(fr)").css("background",'brown');
$("p:lang(fr)").css("background",'orange');
</script>
