My HTML code is similar to this:
<a onclick="customerDelete056b0d37(event)" id="ixnat-d26294a3" data-id="dsddsss3226294a3">
<i data-js="icons" id="it2ul" class="icons">
<polyline points="21 8 21 21 3 21 3 8"></polyline>
<rect x="1" y="3" width="22" height="5"></rect>
<line x1="10" y1="12" x2="14" y2="12"></line>
</i>
</a>
Now I want to get the <a> element if any of the child elements get clicked.
As e.target did return the element that has been click.
Suppose <rect x="1" y="3" width="22" height="5"></rect> got clicked.
then e.target will return <rect x="1" y="3" width="22" height="5"></rect>
But I want the element that has onClick associated like in this case. It will be
<a onclick="customerDelete056b0d37(event)" id="ixnat-d26294a3" data-id="dsddsss3226294a3">
So I can get the data-id attribute of this element. (It can be some other attribute too, just wrote data-id as an example).
Also as I can not use the closest as it will not have a fixed position, nor this will always be a tag. It could be another tag like button.
How to get the element that has event handler on click of child element?
Note: None of the attribute or attribute values will be fixed. All will be dynamic.