I want to wrap <div> FROM THE BEGINNING <H2> to the next <H2> , but it only starts with the first paragraph.
This is what I have that ALMOST does this work:
$('h2:contains("test")').nextUntil('h2').wrapAll('<div class="wrapper" />');
Here is my HTML:
<h2 class='test'>Include this in the wrap</h2> <p>this</p> <p>and this</p> <p>and this</p> <h2 class='next'>before this</h2>
source share