Home >>jQuery Tutorial >jQuery lang() Selector

jQuery lang() Selector

jQuery lang() Selector

jQuery lang() selector in jQuery is used to selects all elements with the language attribute starting with a specified value.

Syntax:
$(":lang(language)")
Here is an Example of jQuery :lang() Selector

<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", "#97d7fc");
});
</script>
</head>
<body>
<p>I live in Noida.</p>
<p lang="it">English</p>
</body>
</html>

Output:

I live in Noida.

English


No Sidebar ads