I have some markup like so:
<li>
<span>
<div>
<a href="#" class="anchor menu-active">Afghanistan</a>
<div class="container menu-visible"></div>
</div>
</span>
<span>
<div>
<a href="#" class="anchor">Kabul(AFT)</a>
<div></div>
</div>
</span>
</li>
I wish to select the very last element with the class anchor
in terms of the li
. The result is that the <a href="#" class="anchor">Kabul(AFT)</a>
should be selected. There can be an arbitary amount of elements with this the anchor
class within the li
.
I came up with this selector: li .anchor:last-of-type
, but it selects both elements in there.
How can I select the absolutely last element with the anchor
class?