I want to clone and prepend a div, however I want to change the prepended div name from preConfi to preConfiXX (eg preConfiA1, preConfiB1) on each iteration. What syntax can I use for this?
/* on initial load, move default template into each GroupX location */
var groups = ['A','B','C','D','E','F','G']
for (var groupLetter in groups){
$('#template').clone().prependTo('#placeholder' + groups[groupLetter]);
}
<!-- ************************** -->
<!-- ******* GROUPS ******** -->
<!-- ************************** -->
<div id='groupA' class='preGroups'>
GroupA
<div id="placeholderA"></div>
</div>
<div id='groupB' class='preGroups'>
GroupB
<div id="placeholderB"></div>
</div>
....
<div id='groupF' class='preGroups'>
<div id="placeholderF"></div>
GroupF
</div>
<div id='template'>
<input type="radio" data-theme="a" name="preConfi" id="radio-choice-1" value="C" />
<input type="radio" data-theme="a" name="preConfi" id="radio-choice-2" value="T" />
<input type="radio" data-theme="a" name="preConfi" id="radio-choice-3" value="P" />
</div>