I'm encountering a situation where I have a group of elements following a specific class that are either empty or contain only white space.
<div class="post-content">
<div class="slider-1-smart">
--- slider contents ---
</div>
<div></div>
<div> </div>
<ul>
<li>Text 1</li>
<li>Text 2</li>
<li>Text 3</li>
</ul>
</div>
I've attempted the following code:
$(function() {
$('.post-content > div:empty').each(function() {
j(this).remove();
});
});
However, this code removes not only the empty elements but also the slider container. How can I specifically target and remove elements after the class "slider-1-smart"?
Any insights would be greatly appreciated. Thank you!