Here is a fiddle of what I have so far. I want to wrap all groups of 'OK' starting classes into their own:
<div class="wrapper">
I figured one possibility could be to take the first element of each group, then run a nextUntil()
until it finds element with class not matching the class, then .wrapAll()
.
It should in the en look like this:
<div class="foo">aaa</div>
<div class="wrapper">
<div class="ok-4">bbb</div>
<div class="ok-21887">ccc</div>
<div class="ok-6">ddd</div>
</div>
<div class="bar">eee</div>
<div class="baz">fff</div>
<div class="wrapper">
<div class="ok-5a4">ggg</div>
<div class="ok-12">hhh</div>
</div>
<div class="bim">iii</div>