Sounds easy, but it doest work: I want to remove ALL Content (text and tags) between two span tags:
<div class="comment-body" id="comment-body-parent-330">
<p><span id="sc_start_commenttext-330"></span>
Some Text<br>
Some Text<br>
Some Text</p>
<p>Some Text<span id="sc_end_commenttext-330"></span>
</p>
Some Text and Code
</div>
Everything you can find between span id "sc_start_commenttext-330" and span id "sc_end_commenttext-330" should be removed, like that:
<p><span id="sc_start_commenttext-330"></span>
<span id="sc_end_commenttext-330"></span>
</p>
I just try it with that Code, but it doenst work:
jQuery("#sc_start_commenttext-330").
nextUntil("#sc_end_commenttext-330").
remove();
The code is generated by a CMS, so its not possivle to change the HTML.
Some ideas? Thanks a lot!
<span>
tags are not on the same level. So what should happen if there is text after the second tag, but still contained inside the<p>
element that contains the<span>
? – Sartorial<p>
element but after the second<span>
? Should it be kept, or deleted? Just checking :-) – Sartorial