开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜