Cloning every child that .clone has
<section class="clone">
<div class="input-group">
<input type="text" class="form-control" placeholder="insert step 2 title*">
</div>
</section>
And cloning with click function
$('.btnAnotherStep').on('click',function(){
var copy = $('.clone>*').clone();
$('.container').append(copy);
Everything is ok but my question is ; Is it possible give different class names to the cloned inputs. Like;
<input type="text" class="form-control input2" placeholder="insert
step 2 title*">
<input type="text" class="form-control input3" placeholder="insert step 2 title*">
<input type="text" class="form-control input4" placeholder="insert step 2 title*">
My first opinion was creating every element from scratch with jquery and for the class name incrementing i by 1
var totalInputs = [];
var i = 0;
while(i < 10){
var input = $("input", {"class": "input[i]"); //but its not possible to refer like that
$('body').append(input);
i++;
}
any way to do that because "" inside this marks it doesnt see it like an number?