How would one select the text inside a span that looks like this?
<span class="season">
<ul class="productBullet">....</ul>
"This is the text I want to select (without the ul above).
</span>
How would one select the text inside a span that looks like this?
<span class="season">
<ul class="productBullet">....</ul>
"This is the text I want to select (without the ul above).
</span>
Try
var text = $(".season").contents().filter(function(i, el) {
return this.nodeType === 3 && $(this).prev().is("ul")
}).text();
$("body").append("<br /><br />selected text: " + text);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js">
</script>
<span class="season">
<ul class="productBullet">....</ul>
"This is the text I want to select (without the ul above).
</span>
"_ at OP ? More than single `#text` node appear within `html` at Question.
– guest271314 Apr 23 '15 at 18:31"_ . The referenced Answer at http://stackoverflow.com/a/14755309/2801559 would return _two_ `#text` nodes ; both `#text` node _within_ `ul` `....` , _and_ `#text` node after `ul` `"This is the text I want to select (without the ul above).` https://jsfiddle.net/3wwk5e4x/
– guest271314 Apr 23 '15 at 18:55