Select all <p> elements with a lang attribute value that starts with "it":
$("p:lang(it)")
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p:lang(it)").css("background-color", "yellow"); });/*from www . j a v a 2 s . c o m*/ </script> </head> <body> <p>this is a test.</p> <p lang="it">this is a test from it</p> </body> </html>
The :lang()
selector selects elements whose the language attribute starts with a specified value.
The value has to be a whole word, either alone, like lang="en", or followed by a hyphen( - ), like lang="en-us".
$(":lang(language)")