Getting the Children of Elements

$("div").children("p");   //selects the <p> elements that are direct children   //of <div> elements

The .children([selector]) method returns a jQuery object representing the children of the elements represented by the current object. You can specify an optional selector that limits the results to only include children that match the selector.

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.