I have the below HTML special content between comments
<p>Regular text</p>
<p>Regular text</p>
<!--Special Content-->
<p>Special Content 1</p>
<p>Special Content 2</p>
<!--/Special Content-->
<p>Regular text</p>
<p>Regular text</p>
<p id="reference">Place special content with comments below this <p> element</p>
I need to wrap the HTML content between the comments <!--Special Content-->
and <!--/Special Content-->
including the comments themselves into a <div>
and move it below the <p id="reference">
element.
I have no access to the actual HTML template so it needs to be done via JavaScript or JQuery.
I haven't be able to find a way to wrap the content including the comments so far.
End result should be:
<p>Regular text</p>
<p>Regular text</p>
<p>Regular text</p>
<p>Regular text</p>
<p id="reference">Place special content with comments below this <p> element</p>
<div id="wrapper">
<!--Special Content-->
<p>Special Content 1</p>
<p>Special Content 2</p>
<!--/Special Content-->
</div>
I appreciate your ideas.