I have a html code :
<div class="body">
<p></p>
<div class="select">
<p class="p1"></p>
<div class="select"></div>
<p class="p2"></p>
</div>
</div>
I want to select div
element with class select
. There are two element of this type which I want the parent one. How can I do that? Pay attention that the above code is just an example and the code can become complex arbitrarily.
Two div
elements with same class may not be direct child and parent of each other and I want to do this by css-selectors
if possible.