I tried to get the input value from the nth
row of a table but I am unable to get under the td value
I tried this
var Clo_Bal = $(thisid).parent().parent().children('.7').html();
but I’m unable to get the value.
Here’s how my table is generated:
var results = '<div style="overflow:auto;"><table id="myTable" class="table table-bordered table-hover dataTable no-footer">';
results += '<thead><tr><th scope="col"></th><th scope="col" >Sno</th><th scope="col" >Agentid</th><th scope="col">Date</th><th scope="col">AgentName</th><th scope="col">Op_Balance</th><th scope="col">SaleValue</th><th scope="col">PaidAmount</th><th scope="col">ClosingValue</th><th scope="col"></th></tr></thead></tbody>';
var k = 1;
for (var i = 0; i < msg.length; i++) {
results += '<tr><td><input id="btn_poplate" type="button" onclick="getme(this)" name="submit" class="btn btn-primary" value="Update" /></td>';
//k++;
results += '<td scope="row" style="text-align:center;">' + k + '</td>';
results += '<th scope="row" class="1" style="text-align:center;">' + msg[i].AgentId + '</th>';
results += '<td class="2">' + msg[i].inddate + '</td>';
results += '<td class="3">' + msg[i].AgentName + '</td>';
results += '<td class="4">' + msg[i].opp_balance + '</td>';
//results += '<td><input id="txt_OpBal" data-title="Code" style="width:65px;" onkeyup="CLChange(this);" class="4" value="' + msg[i].opp_balance + '"/></td>';
results += '<td><input id="txt_SaleValue" class="5" style="width:65px;" value="' + msg[i].salesvalue + '"/></td>';
results += '<td><input id="txt_PaidAmount" class="6" style="width:65px;" value="' + msg[i].paidamount + '"/></td>';
results += '<td><input id="txt_CloBal" class="7" style="width:65px;" value="' + msg[i].clo_balance + '"/></td>';
results += '<td><input id="txt_Sno" class="8" style="width:65px;display:none;" value="' + msg[i].sno + '"/></td></tr >';
k++;
}
results += '</table></div>';
$("#div_BrandData").html(results);