jQuery :contains() Selector

The :contain() selector in jQuery is used to select elements containing the specified text.


The syntax is as follows −


Here, the parameter text is the text to find. The same elements are selected with the specified text.


Let us now see an example to implement the :contains() selector −

<!DOCTYPE html>
   .one {
      color: brown;
      background-color: orange;
      font-size: 16px;
      border: 2px blue dashed;
<script src="https://code.jquery.com/jquery-3.4.1.js"></script>
<p>Timings: 10AM - 1PM</p>
<p>The examination hall details would be emailed to the students.</p>


This will produce the following output −