I am trying to make a loop using javascript. What I want this loop to do is loop two different inputs (text boxes) as many times as the loop count.
So we have two inputs and I am trying to use the concatenation +add+ to loop the text boxes and show each time it loops.
As you see I am failing somewhere because it is not duplicating the inputs or showing the numbers for the concatenation.
http://jsfiddle.net/KT123/hw0h6cr3/1/
My Desired Output
It should show four input text boxes the first two should be labeled street_1 & m2street_1 and the next two street_2 & m2street_2. These should also show "1's" on the first two labels and "2's" on the second two so that we know it worked correctly
Any help or pointers would be greatly appreciated!
var i;
var add = i;
for (i = 1; i <= 2; i++) {
document.write(i);
if (i === 10){
document.write();
} else {
document.write("<br />");
}
}
<div class="clearfix">
<label for="street_+Add+">Mailing Address 1 +add+:</label>
<cfinput type="text" name="street_+Add+" value="">
</div>
<div class="clearfix">
<label for="m2street_+Add+">Mailing Address 2 +add+:</label>
<cfinput type="text" name="m2street_+Add+" value="">
</div>