I wanna use an html in jquery.I use this code :
$(document).ready(function(){
$("#registerNums").click(function(){
var inputnums = parseInt($("#inputnums").val());
for(var i=1; i < inputnums + 1; i++){
var inputmems =
'<div class="form-row">'+
'<div class="form-group col-md-6">'+
'<label for="inputmems">Enter the number of your input' + i + ' ' + 'membership functions:</label>'+
'<input type="text" class="form-control" id="inputmems'+ i + ' ' + 'name="inputmems'+ i + ' ' + ' placeholder="Enter inputmems">'+
'</div>'+
'</div>';
$("#1").after(inputmems);
}
});
});
when i click on my registerNums button it append my form but i get the wrong syntax in my html code using inspect element:
<input class="form-control" id="inputmems1 name=" inputmems1="" placeholder="Enter inputmems" type="text">
that if you see after my id it extends name in it and other problems
how can i fix this?