Is it possible to clone a template then increment template Id after cloning and how to use the new Id after cloning.
I want to increment or create new ID for <div id= "id1">
I want to change the div id that is included in my template.
Here is my code:
function cloneNewId() {
var tmpl = document.getElementById('tempId');
document.body.appendChild(tmpl.content.cloneNode(true));
}
cloneNewId();
cloneNewId();
<template id="tempId">
<div id = "id1">
<select id = "Id">
<option value= "1"> </option>
<option value="2"> </option>
</select>
</div>
</template>
More info about templates in MDN, which is a great javascript resource to always have at hand.