My code is:
<div id="wrap"> <div id="element1" class="ewrap"></div> <div id="element2" class="ewrap"></div> <div id="element3" class="ewrap"></div> <div id="element4" class="ewrap"></div> <div id="element5" class="ewrap"></div> </div>
How would I dynamically remove all elements after element1
?
You could use the .nextAll()
method:
$('#element1').nextAll('div').remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With