O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required