What does the .children() method return?


In the context of this exercise, what does the .children() method return?


The .children() method returns a jQuery object containing all the direct children of the specified element.

You can access individual child elements similarly to accessing elements in an array, by index in the returned object. For example, say that you had the following HTML,

<div class="parent">
  <p>Child 1</p>
  <p>Child 2</p>

We can see the individual child elements by doing something like the following,

var children = $(".parent").children();

console.log(children[0]); // <p>Child 1</p>
console.log(children[1]); // <p>Child 2</p>