children ([expr]) obtaining a set of elements contains elements that match all child elements of each element of the set.

children([expr])

Outline

Obtaining a collection of elements comprises elements that match all child elements of each element of the set.

You can be filtered by the matched child element optional expression. Note: parents () will find all the elements grandparents, and children () considering only child elements regardless of all descendant elements. Which is good marble Measuring Tool

parameter

exprStringV1.0

To filter child element of expression

Examples

description:

Find each sub-element of 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 .selected in each class in 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> ]

Guess you like

Origin www.cnblogs.com/furuihua/p/12012540.html