Selector contains
The :contains selector selects elements that contain the given text.
Syntax
This is how we select elements by the given text. The text can be in quotes or without. This parameter is also case-sensitive:
$(':contains(text)');
Example
Let's select a paragraph with the text bbb, and put the text '!!!' at the end of it:
<p>aaa</p>
<p>bbb</p>
<p>ccc</p>
$('p:contains("bbb")').append('!!!');
HTML the code will look like this:
<p>aaa</p>
<p>bbb!!!</p>
<p>ccc</p>