Given this HTML:
<a href="#" class="artist">Soulive<span class="create-play">Play</span></a>
I want to get the text content of the a (which is this in the context of my function) without the text content of the span, so I’m left with:
Soulive
If I do:
$(this).text();
I get:
SoulivePlay
How do I exclude the text content of the span?
A micro-plugin:
…having this HTML:
will result in:
if you want it faster and you need only to exclude the immediate children… use
.children(instead of.find(