Curious about which jQuery selector to use for selecting elements with the class "bar" only if they are located under a button element (with no class) that is, in turn, placed within a div with the class "foo"
<div class="foo">
<button>
<i class="bar">X</i>
...
The selector ".foo button.bar" is not effective
UPDATE: Appreciate all the suggestions, tried them out but noticed that other elements were also being selected:
<div id="mceu_36" class="mce-widget mce-btn mce-first" tabindex="-1" aria-labelledby="mceu_36" role="button" aria-label="Align left">
<button role="presentation" type="button" tabindex="-1">
<i class="mce-ico mce-i-dashicon dashicons-align-left"></i>
</button>
</div>
...
<div id="mceu_40" class="mce-widget mce-btn" tabindex="-1" aria-labelledby="mceu_40" role="button" aria-label="Edit ">
<button role="presentation" type="button" tabindex="-1">
<i class="mce-ico mce-i-dashicon dashicons-edit"></i>
</button>
</div>
I'm aiming to handle clicks on <i>
elements with the class dashicons-edit only if they are nested under a div with the class mce-first. In the example above, "mce-first" is present in a sibling div.