I would like to split a set of div elements, for further text-processing in an array. A simple mockup:
var divElements = prompt('Input');
array = divElements.split('</div>')
console.log(array);
Input:
<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<div id="4"></div>
Output for now:
array
["<div id="1">", "
<div id="2">", "
<div id="3">", "
<div id="4">", ""]
but I would like to include the separator (div closing tag) inside the array to keep the html syntax intact. As a result the array should have these four items:
<div id="1"></div>
<div id="2"></div>
<div id="3"></div>
<div id="4"></div>