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

jQuery Descendant Selectors

jQuery Selectors

Descendant selectors select all elements that belong to a given ancestor.

The descendants of an element can be its children, grandchildren, great-grandchildren, and so on.

Note:Descendant selectors are used to select elements within an element.

Syntax:

$("ancestor descendant")

Example

Select all <p> elements that are descendants of <div> elements:

$("document").ready(function(){
  $("div p").css("background", "mediumpurple");
});
Test See‹/›

Parameter Value

ParameterDescription
ancestorAny Valid Selector
descendantSelectors to Filter Descendant Elements

jQuery Selectors