Question: I want to make input type text refer to user input, if input 3 it shows 3 new input type text

I try this

```
<input type='text' id='how_many'><input type='button' id='add' value='add'>
<script>
       function add(){

          var total=$('#how_many).val();

          for(var x=0;x<=total;x++){
             //HOW TO ADD INPUT TYPE TEXT BELOW 
          }

       }
</script>

```

Answer: 
Probably you are missing '

```
var total=parseInt($('#how_many').val());

for(var x=0;x<=total;x++){
 $("#mainContainer").append("<input type='text'/>");
}

```
```
$('#add').click(function () {
    for (i=0;i<$('#how_many').val();i++) {
        $(this).after('<div><input type="text" /></div>')
    }
})

```

**[jsFiddle example](http://jsfiddle.net/j08691/Ws7gD/)**