Let's say i create dynamically some divs, each has it's dynamically created id (div0, div1, div2, etc.) and i'd like with a function to pass through currently existent divs and put their innerHTML into an array (one, two, three in this case), how can i achieve this in javascript?
html example:
<div contenteditable="false" id="div0">
<a href="#">one</a>
<span id="one-close">
<i class="material-icons">close</i>
</span>
</div>
<div contenteditable="false" id="div1">
<a href="#">two</a>
<span id="two-close">
<i class="material-icons">close</i>
</span>
</div>
<div contenteditable="false" id="div2">
<a href="#">three</a>
<span id="three-close">
<i class="material-icons">close</i>
</span>
</div>
$('div')(Or your custom selector, like$('#divcontainer > div')) should already be an array. You can use.map()to get the html into an array:$('#divcontainer > div').map(el => $(el).html())