So I have something like this:
<span class="a"> Contents <span class="b">Herp</span><br></span>
…where the “contents” may vary from a string, to a single image to multiple linebreaks. I need to define the “contents” as a variable without getting the b.span and br.
How do you do it? Thank you very much in advance!
Use
.contents()to get all the contents, then apply the.slice()method to slice off the last two: