I have this html
<div class="sbox">
<div class="top-sbox"></div>
<h3>Menu</h3>
<ul class="subpages">
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#" class="last">Subpagina</a></li>
</ul>
<div class="bottom-sbox"></div>
</div>
How can I wrap all elements after div.top-sbox and before div.bottom-sbox. Thank you!
I want this result:
<div class="sbox">
<div class="top-sbox"></div>
<div id="wrapper">
<h3>Menu</h3>
<ul class="subpages">
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#">Subpagina</a></li>
<li><a href="#" class="last">Subpagina</a></li>
</ul>
</div>
<div class="bottom-sbox"></div>
</div>
Here you are.
Edit: sorry. Even simpler: http://jsfiddle.net/ajRd2/1/
$('.top-sbox').nextUntil('.bottom-sbox').wrapAll('<div class="dwrap" />');
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