I would like to know how to remove all the HTML between two strings in a webpage. The webpage will not always have the same content, so this must work no matter what the two strings are and what their positions are. For example,
<div class='foo'>
<div class='userid'>123</div>
<div class='content'>
asdfasdf
</div>
</div>
<div class=bar>
<div class='userid'>456</div>
<div class='content'>
qwerqwer
</div>
</div>
How could I remove all the HTML between ‘asdfasdf’ and ‘123’?
Thanks
This is ugly but it works:
I added a container div. You could use the body tag or something else. Its possible with a regex as well.
Here is a working demo http://jsfiddle.net/QJSJH/.
Edit
I see the post changed quite a bit, but you could use the same concept as above.