I need to select only the innermost div tag that contains specific text when the number of nested div tags is not known.
Given:
<div>
<div>
<div>Some Text</div>
</div>
</div>
The selector should only contain the innermost div tag (and text). Using $("div:contains('Some Text')") returns all three divs since they all contain the text.