:lang() Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:lang


The :lang() selector selects elements by the language attribute starting value.

The following code shows how to select all <p> elements with a lang attribute value that starts with "it":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    $("p:lang(it)").css("background-color", "yellow");
});//from   w  w w .j a va 2s  .  co m

<p>I live in Italy.</p>
<p lang="it">Ciao bella!</p>
<p lang="it-it">Ciao bella!</p>
<p lang="en-it">Ciao bella!</p>
<p lang="it-en">Ciao bella!</p>

Related Tutorials