Home > Web Front-end > JS Tutorial > body text

How to use jQuery :lang()

藏色散人
Release: 2020-11-17 11:51:31
Original
1614 people have browsed it

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.

How to use jQuery :lang()

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>
Copy after login

Running effect:

How to use jQuery :lang()

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)")
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template