1. Home
  2. Javascript
  3. Find closest element
#javascript#select

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
Full Javascript cheatsheet
Sitemap Git repository