find closest element
Finds and selects the closest parent element to the selected one. It will check all elements all the way to the document root.
element.closest('.nav');
copy
Finds and selects the closest parent element to the selected one. It will check all elements all the way to the document root.
element.closest('.nav');
copy