Home >Web Front-end >JS Tutorial >What content filters does jquery have?
There are 4 types of jquery content filters, namely: 1. ":contains(text)" filter; 2. ":empty" filter; 3. ":has(selector)" filter ;4. ":parent" filter.
The operating environment of this tutorial: Windows 7 system, jquery version 1.12, Dell G3 computer.
Recommended: "jquery tutorial"
jquery content filter:
Content filter is included through DOM elements Filter text content and whether it contains matching elements. There are four types of content filters: contains(text), :empty, :has(selector) and :parent, as shown in the following table.
Filter | Description | Example |
:contains(text) | Match elements that contain the given text | $("li:contains('DOM')") //Match li elements that contain "DOM" text content |
:empty | Matches all empty elements that do not contain sub-elements or text | $("td:empty") //Match units that do not contain sub-elements or text Grid |
:has(selector) | Matches elements containing elements matched by the selector | $("td:has(p)") //Match cells containing tags in the cells of the table |
:parent | Match elements containing child elements or text | $("td: parent") //Match cells that are not empty, that is, the cell also includes sub-elements or text |
More programming related For knowledge, please visit: programming teaching! !
The above is the detailed content of What content filters does jquery have?. For more information, please follow other related articles on the PHP Chinese website!