So I have this:
<span class="a"> String <span class="b">Herp</span> </span>
and I need to define span.a's string as a variable without getting span.b's string like:
var a = $(".a").text();
How should I do it?
So I have this:
<span class="a"> String <span class="b">Herp</span> </span>
and I need to define span.a's string as a variable without getting span.b's string like:
var a = $(".a").text();
How should I do it?
var txt1 = $(".a").contents().filter(function() {
return this.nodeType == 3;
}).text();
or like:
var txt1 = $('.a')[0].childNodes[0].nodeValue;