Skip to content

Glossary: JavaScript in the Browser

closest

Also written: closest()

A method that checks an element and then each ancestor, returning the first that matches a selector, or null. It is how a click on a button's inner span is still traced to the button or card.

Where the book teaches it

Related terms

Event delegationBubbling