JSFiddle - React, Tailwind, and code Playground
by j08691
HTML
<ol>
<li class="odd a one">List Item (type1)</li>
<li class="even b two">List Item (type1)</li>
<li class="odd c three">List Item (type1)</li>
<li class="even d one">List Item (type1)</li>
<li class="odd a two">List Item (type1)</li>
<li class="even b three">List Item (type1)</li>
<li class="odd c one">List Item (type1)</li>
<li class="even d two">List Item (type2)</li>
<li class="odd a three">List Item (type2)</li>
<li class="even b four">List Item (type2)</li>
</ol>
JavaScript
$('li:first').nextUntil('li:contains("type2")').addBack().wrapAll('<ol>');
$('li:contains("type2"):first').nextAll().addBack().wrapAll('<ol>');
$('ol:eq(1)').after('<h2>Type 2 starts here</h2>');
$('li:first').closest('ol').unwrap();