jquery to fetch the contents from a selected row in php
Here is the source code , its not able to fetch the selected content when i check the checbox rather its taking all the contents from the table ... Can anyone spot what mistake is in my code开发者_JS百科... thanks for ur time
for(k=0;k<=9000;k++) {
//each change
$("#status"+k).click(function() {
for(j=0;j<=numOflimit;j++) {
var product_name = encodeURIComponent($('#product_name'+j).val());
alert(product_name);
var barcode = encodeURIComponent($('#barcode'+j).val());
var Quantity = encodeURIComponent($('#Quantity'+j).val());
var cart=product_name + barcode + Quantity;
alert(cart);
$('#cart1').val(cart);
}
});
});
You have two loops here. The outer one seems to attach a click handler to all rows (or to the checkboxes of each row). The inner one however makes no sense. It's result is that no matter what checkbox you click, it will iterate over all rows and collect the values.
精彩评论