Home >>jQuery Tutorial >jQuery :contains() Selector

jQuery :contains() Selector

jQuery :contains() Selector

jQuery :contains() selector in jQuery is used to selects elements containing the specified string contained directly in the element as text, or in a child element.


Parameter Values

Parameter Description
text It is a Required parameter and used to Specifies the text to find
Here is an Example of jQuery :contains() Selector:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
$("p:contains(is)").css("background-color", "#97d7fc");
<h1>Welcome to Phptpoint</h1>
<p class="intro">My name is phptpoint</p>
<p>I live in Noida.</p>
Who is your favourite:
<ul id="choose">


Welcome to Phptpoint

My name is phptpoint

I live in Noida.

Who is your favourite:
  • JAVA
  • jQuery
  • Javascript

No Sidebar ads