Question: How do I get multiple textbox values that are dynamically created in jquery

Sample code:

```
<?php
$i=1;
while($i<10)
{
     echo "<input type='textbox' class='qty' id='qty_$id'>";
     echo "<input type='textbox' class='item' id='item_$id'>";
     $i++;
}
echo '<input class="btn_transaction" id="btn_update" type="button" style="width:auto" value="Update">';

?>

```

jquery 

```
<script>
jQuery(document).ready(function(e){
  $("#btn_update").click(function() {
        $.each($('.qty'), function() {
        var qty =  $(this).val();
        alert(qty);  // im getting qty here. In the same way i want item also, how to get item value here
        jQuery.post('../ajax/ajax_cart.php',{section:'update_tocart',qty:qty},function(data){

        });             
     });

  });

});            
</script>

```

thanks in advance :)

Answer: 
**[DEMO](http://jsfiddle.net/CDtKX/)**

Try this

```
$("#btn_update").click(function() {
        $(".qty").each(function() {
           var qty =  $(this).val();
           alert(qty);      
     });

  });

```

Hope this helps,Thank you
add class to all your textbox e.g textbox

```
<script type="text/javascript">
    var Work = [];
var textboxes = document.getElementsByClassName('name_list');
var boxlengt = document.getElementsByClassName('name_list').length;
for(var i=0;i<boxlengt;i++){
    Work.push(textboxes[i].value)
}
Work = Work.toString();
</script>

```

All the values are being stored in the items array. Now its up to you how you want each values to be used.