Let's say my HTML may look one of two ways:
Option 1:
<h2>My header
<span class="apple">My Span</span>
</h2>
Option 2:
<h2>My header</h2>
Via jAuery, I want to append a span to either the nested span (if it's there) or to the header directly, resulting in one of these:
Option 1:
<h2>My header
<span class="apple">My Span
<span>My Span Inserted via jQuery</span>
</span>
</h2>
Option 2:
<h2>My header
<span>My Span Inserted via jQuery</span>
</h2>
Is there a clever selector that would detect both of the above scenarios? I could, of course, first check to see if my header has a span with a class of 'apple' within it. If so, do this, else, do that. I was wondering if there was a more elegant and less verbose solution, though.