jQuery Parent DescendantSelector

jQuery 选择器jQuery Selectors

Example

Select all <span> elements that are descendants of a <div> element:

$("div span")

Try it Yourself »

Definition and Usage

The ("parent descendant") selector selects all elements that are descendants of the specified element.

A descendant of an element can be the first generation, second generation, third generation, and so on, of the element.


Syntax

("parent descendant")

Parameter Description
parent Required. Specifies the parent element to be selected.
descendant Required. Specifies the descendant elements of the specified parent element to be selected.


实例

Try it Yourself - Examples

Select all <li> elements that are descendants of a <ul> element
How to select all <li> elements that are descendants of a <ul> element.


jQuery 选择器jQuery Selectors

Other Extensions