Skip to content
Justice Tech School

Parents and Children

parent, parents, children and closest move up and down the tree. closest finds the nearest ancestor that matches.

Example
$('span').parent();
$('ul').children('li');
$('button').closest('.card');

Exercise

Nearest matching ancestor.

$('b').('.card')

Quiz Test

What does children return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.