Home > Article > Web Front-end > How to use jQuery :lang()
jQuery :lang() selector is used to select elements that specify the language attribute lang. Its usage syntax is "$(":lang(language)")". The value must be the entire word, or it can be a separate , can also be followed by a connector.
Recommended: "javascript basic tutorial"
jQuery :lang() selector
Example
Select all
elements whose lang attribute is "it":
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("p:lang(it)").css("background-color","yellow"); }); </script> </head> <body> <p>我住在意大利。</p> <p>Ciao bella!</p> </body> </html>
Running effect:
Definition and usage
:lang() selector selects elements with the specified language attribute (lang).
Note: The value must be the entire word, either alone, such as, or followed by a connector (-), such as.
Grammar
$(":lang(language)")
The above is the detailed content of How to use jQuery :lang(). For more information, please follow other related articles on the PHP Chinese website!