Menu
Assume I have the following simplified code:
“`
<div> “1”
<div> “2”
<p>
<div> “3”
<span>
<img class=”sample”>…</img>
</span>
</div>
</p>
</div>
</div>
Now I want to refer to innermost parent <div> element which contains a child element with class “sample”.
Here it is an <img> element in other cases it could be a <figure> or whatever.
As target <div> element I would like to get the <div> labelled here with “3”.
How can I achieve this?
If possible as jQuery statement.
Thank you