English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery :contains() Selector

jQuery Selectors

The :contains() selector selects all elements that contain the specified text.

The text can be directly contained within the element or within a child element.

Syntax:

$(":contains(text)")

Example

Select each <p> element that contains "is":

$("document").ready(function(){
  $("p:contains(is)").css("background", "coral");
});
Test See‹/›

Parameter Value

ParameterDescription
textThe text string to be searched. Case sensitive

jQuery Selectors