Imagine that I have this HTML snippet:
<div></div>
<br />
<div></div>
<br />
<img src='' alt='' />
<p></p>
<br />
<br />
<br />
<div></div>
<a href=''></a>
<br />
Which has no definite rule at all. The only thing I know, is that 3 consecutive <br /> elements exist somewhere. Now, I need to find the three consecutive <br /> elements using jQuery, and remove anything after them.
How can I do that?
If there are potential text nodes to be removed, do this:
Or with more jQuery: