Let's say I have the following markup:
<p></p>
<p>not empty</p>
<p>not empty</p>
<p></p>
<div class="wrapper">
// more content inside
</div>
<p> </p> <-- whitespace, also removed
<p></p>
<p>not empty</p>
How do I remove the empty <p>
tags closest to .wrapper
? I want a result like this:
<p></p>
<p>not empty</p>
<p>not empty</p>
<div class="wrapper">
// more content inside
</div>
<p>not empty</p>
So I don't want to remove all empty siblings, just the empty ones next to .wrapper
, even if there are multiple.
tags.
– qwerty Nov 01 '12 at 11:19