Move around the DOM

Start from one element and walk to the ones you need.

jQuery · Move around the DOMBeginner
const $btn = $('.edit');

$btn.closest('tr');                 // nearest ancestor row
$btn.parent();                      // direct parent
$('#menu').find('a');               // all links inside
$('#menu li').first().next();       // second item
$('.active').siblings();            // other items next to it
$('.child').parents('.card');       // all matching ancestors

const rowTitle = $btn.closest('tr').find('.title').text();
findclosestparentsiblingsnext