jQuery Tutorial Tutorials - jQuery :contains() selector

:contains() selector

The jQuery :contains selector is used to select the element that it's content contains the specified string.The string is case-sensitive.

jQuery :contains() selector Syntax

$(':contains(string)')

jQuery :contains() selector Examples

Following is a simple example which would find all div containing 'jQuery' and hightlight them:

<div>jQuery books</div>
<div>jquery tutorial</div>
<div>jQuery Examples</div>
<div>j.Query</div>
<script>
   $("div:contains('jQuery')").css('background','cyan');
</script>

In below example,We will search from a content list:

Try now

Date:2019-08-18 13:10:56 From:www.Lautturi.com author:Lautturi