.parent() / .children() / .siblings()
method
Traverse the DOM tree relative to the selected element.
Syntax
$(selector).parent() .children() .siblings()
Example
javascript
// Get parent element
$('#item').parent();
$('#item').parents('.container'); // all ancestors
$('#item').closest('.card'); // nearest ancestor
// Get direct children
$('#list').children('li');
$('#list').children('.active');
// Get siblings
$('#item').siblings();
$('#item').siblings('.highlight');
// Next / previous
$('#item').next();
$('#item').prev();