0

How would one select only the 'foo' text (and not the span) in this example?

<div class="bar">foo
    <span>...</span>
</div>

Alternatively, what would your search query to figure this out be? I'm at a loss...

AlecPerkey
  • 659
  • 2
  • 11
  • 21

1 Answers1

1

With JQuery & cheerio, it seems one can use :

$('div.bar').contents()[0]

src: How do I select text nodes with jQuery?

Community
  • 1
  • 1
AlecPerkey
  • 659
  • 2
  • 11
  • 21