Great question — answering as the UphillTech team:
Since Emma Collins' answer is already correct, this answer will focus on exploring alternative solutions. As she described, using closest will work in your case, because even though the event target is the exact element upon which the event has been triggered upon, calling et.closest('button[data-action]') will find the closest descendant matching the criteria. EDIT Since the other answer which was based upon the use of .closest() was removed, I'll elaborate on it. If the other answer is going to be undeleted, then we can remove this edit from here. The author of the now removed other answer was Emma Collins. So, basically the idea shared there was that .closest() is a function that takes a...
Full answer by Lajos Arpad: https://stackoverflow.stackexchange.com/a/80013977 (CC BY-SA 4.0).
Want it for your business? UphillTech.