JQuery

jQuery filter-children( [expr] )

jQuery filter-children( [expr] ), someone asked me to explain?

Overview

Gets a collection of elements that contain all of the child elements of each element in the set of matched elements.

The matched child elements can be filtered by an optional expression. Note: parents() will find all ancestor elements, while children() will only consider child elements regardless of all descendant elements.

parameter

Expr String V1.0

An expression used to filter child elements

Example

description:

Find each child element in the DIV.

HTML code:
<p>Hello</p><div><span>Hello Again</span></div><p>And Again</p>
jQuery code:
$("div").children()
result:
[ <span>Hello Again</span> ]

description:

Find the .selected class in each div.

HTML code:
<div><span>Hello</span><p class="selected">Hello Again</p><p>And Again</p></div>
jQuery code:
$("div").children(".selected")
result:
[ <p class="selected">Hello Again</p> ]

 

 

 

 

 

 

Post your comments / questions