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: 
There you go:

```
<div class="container">
    <input type='text' id='how_many' />
</div>

<input type='button' id='add' value='add' />

<script type="text/javascript">
       $(document).ready(function() {
          $("#add").click(function(e) {
               var $el = $('#how_many'),
              total = $el.val();

              for (var x=0;x<=total;x++){
                  $(".container").append($el.val("").clone().attr("id", "total_" + x));
              }
          });
       });
</script>

```

Where '.clone()' is a jQuery method which clones the DOM node, '.append()' is a jQuery method to append the newly cloned node to another node.
Remember to parse your input, then just create:

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

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

```

Trigger the `add()` function on a `blur`

```
$("#how_many").blur(add);

```