如何在jquery表中获取textbox的值值

时间:2017-01-01 20:26:27

标签: javascript jquery html asp.net-mvc model-view-controller

我正在从这个表中使用jquery表我使用复选框获取行数据,我在这个表中有一些文本框是这些文本框的问题当我检查第一行时文本框中的值得到正确然后当我检查时第二行td文本已更改,但第二行的文本框值未更改,它与第一行保持相同,我希望获得每行的正确值,以帮助我。

Jquery表 这就是我填充它的方式

$('#view').on('click', 'input[type="checkbox"]:checked', function () {
                    var row = $(this).closest('tr');
                    var id = row.find('td:eq(0)').text();
                    var fname = row.find('td:eq(1)').text();
                     var sname = row.find('td:eq(2)').text();
                     var cname = row.find('td:eq(3)').text();
                     var amount = row.find('td:eq(4)').text();
                     var paid = $('#paid').val();
                     var discount = $('#Discount').val();
                     var netAmount = $('#NetAmount').val();

                     info.push({
                         Fee_Id: id,
                         FeeHeadName: fname,
                         sname: sname,
                         cname: cname,
                         Amount: amount,
                         Paid: paid,
                         Discount: discount,
                         NetAmount: netAmount
                     });
                     console.log(info);                    
                });

我附上了表格图片 enter image description here

我如何获得价值

{{1}}

第一行控制台数据的附加图像 enter image description here

第2行控制台数据的附加图像 enter image description here

1 个答案:

答案 0 :(得分:0)

您需要从行中获取输入值:

var paid = row.find('#paid').val();
var discount = row.find('#Discount').val();
var netAmount = row.find('#NetAmount').val();