Simple Question from a beginner/learner in JS.
How to get the number value in dropdown select and create element input textboxes from the value selected?
I have a select option with number values, I want to create a number of textboxes when select a number in the options.
For example: On the dropdown I select 8, so it need to output 8 texboxes.
my code below:
<select class="form-control" id="textboxes">
<option>8</option>
<option>9</option>
<option>10</option>
<option>11</option>
<option>12</option>
</select>
var textboxNumbers = document.getElementById("textboxes").value;
var i;
for(i=0; i<textboxNumbers; i++){
var yourTextboxes = document.createElement("INPUT");
yourTextboxes.setAttribute("type", "text");
document.getElementById("balls").appendChild(yourTextboxes);
}