contains selector
Description: Select all elements that contain the specified text.
-
version added: 1.1.4jQuery( ":contains(text)" )
text: A string of text to look for. It's case sensitive.
The matching text can appear directly within the selected element, in any of that element's descendants, or a combination thereof. As with attribute value selectors, text inside the parentheses of :contains()
can be written as a bare word or surrounded by quotation marks. The text must have matching case to be selected.
Example:
Finds all divs containing "John" and underlines them.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
|