I think what you need is to use the event.currentTarget
. This will contain the element that actually has the event listener. So if the whole <section>
has the eventlistener event.target
will be the clicked element, the <section>
will be in event.currentTarget
.
Otherwise parentNode
might be what you’re looking for.