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

jQuery > Child Element Selector

jQuery Selectors

Child selectors (>) select all elements that are direct children of the specified element.

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

Syntax:

$("parent > child")

Example

Select all <p> elements that are direct children of the <div> element:

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

Parameter Value

ParameterDescription
parentAny valid selector
childSelector for Filtering Child Elements

jQuery Selectors