Home  >  Article  >  Web Front-end  >  What content filters does jquery have?

What content filters does jquery have?

藏色散人
藏色散人Original
2020-11-27 10:21:222639browse

There are 4 types of jquery content filters, namely: 1. ":contains(text)" filter; 2. ":empty" filter; 3. ":has(selector)" filter ;4. ":parent" filter.

What content filters does jquery have?

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to solve jquery errorNext article:How to solve jquery error