I am new to d3 and am trying to create a function to dynamically add a certain number of text boxes to an html form, but have not been sucessful. Here is my code. What is the issue?
for (i=0;i<numLines;i++){
var div = document.getElementById('user-input');
div.innerHTML += '<input id="textfield_"+i type="text" value="text_"+i>';
}
Here is the html code:
<div id="container-exp">
<div id="Stage 2">
<center>
<button type="button" id="show-example" value="show-example" class="btn btn-primary btn-lg example"">
Show Example
</button>
</center><br/><br/>
<div class="col-xs-2">
</div>
<div id="passage"></div>
Fill out the below with the information in the above passage. To see an example, please click the button "Show example" above.
</div id="user-input">
<div class="col-xs-2">
<button type="button" id="next" value="next" class="btn btn-primary btn-lg continue">
Next <span class="glyphicon glyphicon-arrow-right"></span>
</button>
</div>
<center>tag has been deprecated for years. What has this to do with d3? You can add these elements with d3 but you do it the hard way.